#include <bits/stdc++.h>
using namespace std;
int notes, base;
int candos;
bool exists[1000001];
bool cando[1000001];
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  cin >> notes >> base;
  int a = base;
  for (int i = 0; i < notes; i++) {
    int b;
    cin >> b;
    a = gcd(a, b);
  }
  cout << base / a << endl;
  for (int i = 0; i < base; i += a) {
    cout << i << " ";
  }
  printf("\n");
}
