a,b,c=34,55,89 n,m=map(int,input().split()) for _ in [0]*(n-10):a,b,c=b,c,b+c print(a%m)