import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
int[] num = new int[N+1];
int cnt = 0;
for (int i = 2; i < num.length; i++) {
for (int j = i; j < num.length; j+=i) {
if(num[j] !=0) continue;
num[j] = i;
cnt++;
if(cnt == K) {
System.out.println(j);
break;
}
}
}
}
}