#include <bits/stdc++.h>
using namespace std;
ifstream f("date.in");
queue<long long> q;
long long n, k, fr[1000001];
long long GCD(long long x, long long y) {
  long long r;
  do {
    r = x % y;
    x = y;
    y = r;
  } while (y != 0);
  return x;
}
int main() {
  long long ans;
  cin >> n >> k;
  ans = k;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    ans = GCD(x, ans);
  }
  cout << k / ans << '\n';
  for (int i = 0; i < k / ans; i++) cout << i * ans << " ";
}
