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