#include <bits/stdc++.h>
using namespace std;
int n, k, a, b, r, i;
int main() {
  cin >> n >> k;
  a = 0;
  for (i = 1; i <= n; i++) {
    cin >> b;
    while (b) {
      r = a % b;
      a = b;
      b = r;
    }
  }
  b = k;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  cout << k / a << '\n';
  b = 0;
  for (i = 1; i <= k / a; i++) {
    cout << b << " ";
    b += a;
  }
  return 0;
}
