#include <bits/stdc++.h>
using namespace std;
const int RLEN = 1 << 18 | 1;
inline char nc() {
  static char ibuf[RLEN], *ib, *ob;
  (ib == ob) && (ob = (ib = ibuf) + fread(ibuf, 1, RLEN, stdin));
  return (ib == ob) ? -1 : *ib++;
}
inline int rd() {
  char ch = nc();
  int i = 0, f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = nc();
  }
  while (isdigit(ch)) {
    i = (i << 1) + (i << 3) + ch - '0';
    ch = nc();
  }
  return i * f;
}
const unsigned long long base = 998244353;
const int mod = 1e9 + 7;
const int N = 2e5 + 50;
unsigned long long pw[N], pre[N], suf[N];
int n, a[N], M;
unordered_map<int, int> mp;
int main() {
  n = rd(), M = rd();
  for (int i = 1; i <= n; i++) a[i] = rd();
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) mp[a[i]] = i;
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = pw[i - 1] * base;
  for (int i = 2; i <= n; i++) pre[i] = pre[i - 1] * base + a[i] - a[i - 1];
  for (int i = n - 1; i >= 1; i--)
    suf[i] = suf[i + 1] + pw[n - i - 1] * (a[i + 1] - a[i]);
  vector<int> vec;
  unsigned long long hv(0);
  for (int i = 2; i <= n; i++) hv = hv + pw[i - 2] * (a[i] - a[i - 1]);
  for (int i = 1; i <= n; i++) {
    unsigned long long tar;
    if (i != n)
      tar = suf[i + 1] * pw[i] + (a[1] - a[n] + M) * pw[i - 1] + pre[i];
    else
      tar = suf[1];
    if (hv == tar) vec.push_back((a[1] + a[i]) % M);
  }
  sort(vec.begin(), vec.end());
  printf("%d\n", vec.size());
  for (int i = 0; i < vec.size(); ++i) printf("%d ", vec[i]);
}
