""" """ import sys from sys import stdin N,M = map(int,stdin.readline().split()) ans = [] while True: if N == 1 or M == 0: ans.append(0) ans.append(M) break else: p = N // M ans.append(p) N,M = M , N % M #print (N,M) while len(ans) > 0 and ans[-1] == 0: del ans[-1] print (*ans)