#include <bits/stdc++.h>
using namespace std;
int n, k;
const int maxn = 1e5 + 5;
long long a[maxn];
int GCD(long long x, long long y) {
  if (y == 0) {
    return x;
  } else {
    return GCD(y, x % y);
  }
}
int main() {
  cin >> n >> k;
  int gcd = k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    gcd = GCD(gcd, a[i]);
  }
  int count = 0, flag = 1;
  cout << k / gcd << endl;
  while (count < k) {
    if (flag) {
      cout << count;
      flag = 0;
    } else {
      cout << " " << count;
    }
    count += gcd;
  }
  return 0;
}
