q,k = map(int,input().split()) index = k-1 lst = [] def ins(x): l_len=len(lst) if l_len==0: lst.append(x) else: s,t = 0,l_len while True: m=(s+t)//2 if m==l_len: lst.append(x) return elif lst[m]==x or not s=k: print(lst.pop(index)) else: print(-1)