N, K = map(int, input().strip().split(' ')) for i in range(N-1): input() if N < K: print(-1) else: print(K - 1)