#include <bits/stdc++.h>
using namespace std;
long long ans;
long long N, base;
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
int main() {
  cin >> N >> base;
  long long num;
  for (int i = 0; i < N; i++) {
    cin >> num;
    if (ans == 0)
      ans = num;
    else
      ans = gcd(ans, num);
  }
  ans = gcd(ans, base);
  long long cnt = base / ans;
  if (base % ans == 0) {
    printf("%lld\n", cnt);
    for (int i = 0; i < cnt; i++) {
      printf("%lld ", ans * i);
    }
  } else {
    printf("%lld\n", cnt);
    for (int i = 1; i <= cnt; i++) {
      printf("%lld ", ans * i);
    }
  }
  return 0;
}
