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 map = new HashMap<>(); int x = n; for (int i = 2; i <= Math.sqrt(x); i++) { while (x % i == 0) { if (map.containsKey(i)) { map.put(i, map.get(i) + 1); } else { map.put(i, 1); } x /= i; } } if (x > 1) { if (map.containsKey(x)) { map.put(x, map.get(x) + 1); } else { map.put(x, 1); } } int max = 0; int maxNumber = 0; for (int i = 2; i < n; i++) { int y = i; int count = 0; for (Map.Entry entry : map.entrySet()) { for (int j = 0; j < entry.getValue() && count < k; j++) { if (y % entry.getKey() == 0) { y /= entry.getKey(); count++; } else { break; } } if (count >= k) { break; } } if (count >= k) { int m = getCount(i); if (max < m) { max = m; maxNumber = i; } } } System.out.println(maxNumber); } static int getCount(int x) { int count = 1; for (int i = 2; i <= Math.sqrt(x); i++) { if (x % i == 0) { int cnt = 0; while(x % i == 0) { cnt++; x /= i; } count *= (cnt + 1); } } if (x > 1) { count *= 2; } return count; } }