#include <bits/stdc++.h>
using namespace std;
long long mod_pow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    n >>= 1;
  }
  return res;
}
int N, M;
long long A[200010], B[200010];
long long h[200010], rh[200010];
long long p[200010], inv[200010];
long long calc(long long l, long long r, bool rev) {
  if (!rev) {
    return ((h[r] - h[l] + 1000000007) * inv[l]) % 1000000007;
  } else {
    return (rh[r] - (rh[l] * p[r - l] % 1000000007) + 1000000007) % 1000000007;
  }
}
int main() {
  scanf("%d%d", &N, &M);
  for (long long i = (long long)(0); i < (long long)(N); i++) {
    scanf("%lld", A + i);
    if (i > 0) B[i - 1] = A[i] - A[i - 1];
  }
  p[0] = 1;
  for (long long i = (long long)(0); i < (long long)(N + 1); i++)
    p[i + 1] = p[i] * 10007 % 1000000007;
  for (long long i = (long long)(0); i < (long long)(N + 1); i++)
    inv[i] = mod_pow(p[i], 1000000007 - 2);
  for (long long i = (long long)(0); i < (long long)(N - 1); i++) {
    h[i + 1] = (h[i] + B[i] * p[i]) % 1000000007;
    rh[i + 1] = (rh[i] * 10007 + B[i]) % 1000000007;
  }
  vector<int> res;
  if (calc(0, N - 1, false) == calc(0, N - 1, true)) {
    res.push_back((A[0] + A[N - 1]) % M);
  }
  for (long long i = (long long)(0); i < (long long)(N - 1); i++) {
    long long vl = (A[0] + A[i]) % M;
    long long vr = (A[i + 1] + A[N - 1]) % M;
    if (vl != vr) continue;
    if (calc(0, i, false) == calc(0, i, true) &&
        calc(i + 1, N - 1, false) == calc(i + 1, N - 1, true))
      res.push_back(vl);
  }
  sort((res).begin(), (res).end());
  res.erase(unique((res).begin(), (res).end()), res.end());
  cout << res.size() << endl;
  for (long long i = (long long)(0); i < (long long)(res.size()); i++)
    cout << res[i] << " ";
  cout << endl;
  return 0;
}
