์ฝ์ ๊ตฌํ๊ธฐ
N,K = map(int,input().split())
cnt = 0
flag = 0
for i in range (1,N+1):
if ( N % i == 0):
tmp = i
cnt+=1
if (cnt == K):
print (i)
flag = 0
break
elif (cnt < K):
flag = 1
if (flag == 1):
print(0)