#include <bits/stdc++.h>
using namespace std;
const int maxn = int(1e5) + 111;
int n, k;
int ok[maxn];
int gcd(int n, int m) {
  if (m == 0)
    return n;
  else
    return gcd(m, n % m);
}
int main() {
  scanf("%d%d", &n, &k);
  int x, cur = k;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    cur = gcd(cur, x);
  }
  printf("%d\n", k / cur);
  for (int i = 0; i < k; ++i)
    if (i % cur == 0) printf("%d ", i);
  return 0;
}
