#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long x = 0, o = 1;
  register char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = ((x << 3) + (x << 1)) + ch - '0', ch = getchar();
  return x * o;
}
int n, m, a[201000], fa[201000], cha[201000], f[201000], g[201000], ans,
    Ans[201000];
unsigned long long hs1[201000], hs2[201000], sum[201000];
map<int, int> M;
inline unsigned long long GetHash(int l, int r, unsigned long long *Hs) {
  if (r < l) return -1;
  return Hs[r] - Hs[l - 1] * sum[r - l + 1];
}
int main() {
  n = read(), m = read(), sum[0] = 1;
  for (register int i = 1; i <= n; ++i)
    a[i] = read(), M[a[i]] = 1, sum[i] = sum[i - 1] * 1000000001;
  sort(a + 1, a + 1 + n);
  for (register int i = 1; i < n; ++i)
    cha[i] = a[i + 1] - a[i], hs1[i] = hs1[i - 1] * 1000000001 + cha[i];
  for (register int i = n - 1; i; --i)
    hs2[i] = hs2[i + 1] * 1000000001 + cha[i];
  f[1] = f[2] = g[n] = g[n - 1] = 1;
  for (register int i = 2; i < n; ++i) {
    int mid = i / 2;
    if (hs1[mid] == hs2[i - mid + 1] - hs2[i + 1] * sum[mid]) f[i + 1] = 1;
    if (hs2[n - 1 - mid + 1] ==
        hs1[n - 1 - i + mid] - hs1[n - 1 - i] * sum[mid])
      g[n - i] = 1;
  }
  for (register int i = 1; i <= n; ++i) {
    if (f[i] && g[i + 1]) {
      int le = a[1] + a[i], ri = (a[i + 1] + a[n]) % m;
      if (le == ri) Ans[++ans] = le;
    }
  }
  if (f[n]) Ans[++ans] = (a[1] + a[n]) % m;
  printf("%d\n", ans);
  sort(Ans + 1, Ans + 1 + ans);
  for (register int i = 1; i <= ans; ++i) printf("%d ", Ans[i]);
}
