#WA (項の数が60を超える) N,M=map(int,input().split()) A=[] while M: q,r=divmod(N,M) A.append(q) N,M=M,r B=A[:-1]+[0]*20+[A[-1]] print(*B)