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(); HashMap inner = new HashMap<>(); int x = n; for (int i = 2; i <= Math.sqrt(n); i++) { while (x % i == 0) { inner.put(i, inner.getOrDefault(i, 0) + 1); x /= i; } } if (x > 1) { inner.put(x, inner.getOrDefault(x, 0) + 1); } int[] totals = new int[n]; int max = 0; int ans = 0; for (int i = 2; i < n; i++) { boolean flag = (totals[i] == 0); for (int j = 1; j * i < n; j++) { totals[i * j]++; } if (max < totals[i]) { if (getCount(i, inner) >= k) { max = totals[i]; ans = i; } } } System.out.println(ans); } static int getCount(int x, HashMap inner) { int count = 0; for (int y : inner.keySet()) { for (int i = 0; i < inner.get(y); i++) { if (x % y == 0) { count++; x /= y; } else { break; } } } return count; } }