n,m = map(int, input().split()) a = 0 b = 1 ls = [0 , 1] for i in range(n - 2): a, b = b, a+b print(b) print(b%m)