def sieve(n): primes = [1 if i%2 == 1 else 0 for i in range(n + 1)] primes[1] = 0 primes[2] = 1 for i in range(3,n + 1,2): if i * i > n: break if primes[i]: for j in range(i * i,n + 1,i): primes[j] = 0 return [p for p in range(2,n + 1) if primes[p] == 1] def Factor(n,k,primes,fact): ans = 1 common_prime = 0 for p in primes: cnt = 1 while n%p == 0: n //= p cnt += 1 ans *= cnt if p in fact: common_prime += min(cnt - 1,fact[p]) if n!= 1: ans *= 2 if n in fact: common_prime += 1 if common_prime >= k: return ans else: return -1 n,k = map(int,input().split()) primes = sieve(int(n ** 0.5) + 3) fact = {} m = n for p in primes: while n%p == 0: n //= p if p in fact: fact[p] += 1 else: fact[p] = 1 if n != 1: fact[n] = 1 ans = 10 ** 9 cnt = 0 for i in range(1,m): ret = Factor(i,k,primes,fact) if cnt < ret: ans = i cnt = ret print(ans)