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()