n,k = map(int, input().split(" ")) for _ in range(999): input() if n % (k + 1) == 0: print("0 1000") else: print("1000 0")