#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, k;
  cin >> n >> k;
  long long x = k;
  for (long long i = 0; i < n; i++) {
    long long y;
    cin >> y;
    x = gcd(x, y);
  }
  cout << (k / x) << endl;
  for (long long i = 0; i * x < k; i++) {
    cout << (i * x) << " ";
  }
  cout << endl;
}
