def prime_factors(N): res = [] for i in range(2, int(N ** 0.5) + 1): while N % i == 0: res.append(i) N //= i if N != 1: res.append(N) return res def divisors(N): res = 0 for i in range(1, int(N ** 0.5) + 1): if N % i == 0: res += 1 if i * i != N: res += 1 return res N, K = map(int, input().split()) N_pf = prime_factors(N) #print(N, N_pf) ma, ans = 0, -1 for M in range(N): i_pf = prime_factors(M) j = 0 cnt = 0 #print(M, i_pf) for p in i_pf: if j < len(N_pf) and p in N_pf[j:]: j = j + N_pf[j:].index(p) + 1 cnt += 1 if cnt >= K: d = divisors(M) if ma < d: ma = d ans = M print(ans)