def main(): N, K = map(int, input().split()) for _ in range(N-1): input() if N < K: print(-1) else: print(K-1) if __name__ == "__main__": main()