#include <bits/stdc++.h>
using namespace std;
int a[200309], n, k;
int gcd(int x, int y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; (i) < int(n); (i)++) {
    scanf("%d", &a[i]);
  }
  int g = k;
  for (int i = 0; (i) < int(n); (i)++) {
    g = gcd(g, a[i]);
  }
  vector<int> ans;
  for (int i = 0; (i) < int(k); (i)++) {
    if (i % g == 0) ans.push_back(i);
  }
  printf("%u\n", ans.size());
  for (int i : ans) printf("%d ", i);
  printf("\n");
  return 0;
}
