x = 1 y = 0 N, M = map(int, input().split()) for i in range(N): x, y = y, (x + y) % M print(x)