n, m = map(int,input().split(' ')) x = 0 y = 1 for i in range(n-1): x, y = y, (x + y) % m print(x)