#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
void swap(int* a, int* b) {
  int tmp = *a;
  *a = *b;
  *b = tmp;
}
int main() {
  int N, X;
  cin >> N >> X;
  int ans = N;
  int a = X, b = N - X;
  if (a < b) swap(&a, &b);
  cout << ans << "\n";
  while (b) {
    ans += (a + b);
    int tmp = a;
    a = a / b;
    b = tmp % b;
    if (a < b) swap(&a, &b);
    cout << ans << "\n";
  }
  cout << ans << "\n";
  return 0;
}
