#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const long long MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
void solve() {
  int n, m, a;
  scanf("%d%d", &n, &m);
  int ans = m;
  for (int i = (0); i < (int)(n); i++) {
    scanf("%d", &a);
    ans = gcd(ans, a);
  }
  printf("%d\n", m / ans);
  for (int i = (0); i < (int)(m / ans); i++) {
    printf("%d ", i * ans);
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
