N,M=map(int,input().split()) A=[] while M: q,r=divmod(N,M) A.append(q) N,M=M,r print(*A)