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