#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 1e5 + 10;
inline long long po(long long a, long long p, long long mod) {
  long long r = 1;
  for (; p; p >>= 1, a = a * a % mod)
    if (p & 1) r = r * a % mod;
  return r;
}
const long long mod1 = 1e9 + 7;
const long long mod2 = 1e9 + 9;
const long long bas = 1e9 + 3;
int n;
int m;
long long a[N];
long long b[N];
long long pa1;
long long pa2;
long long sa1;
long long sa2;
long long pb1;
long long pb2;
long long sb1;
long long sb2;
long long mi1[N];
long long mi2[N];
long long imi1[N];
long long imi2[N];
long long ans[N];
int tp;
long long inv1;
long long inv2;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + n + 1);
  for (int i = 1, j = n; i <= n; i++, j--) b[j] = a[i];
  mi1[0] = 1;
  for (int i = 1; i <= n; i++) (mi1[i] = mi1[i - 1] * bas) %= mod1;
  mi2[0] = 1;
  for (int i = 1; i <= n; i++) (mi2[i] = mi2[i - 1] * bas) %= mod2;
  for (int i = n; i >= 1; i--)
    pa1 = (pa1 * bas + a[i]) % mod1, pa2 = (pa2 * bas + a[i]) % mod2,
    pb1 = (pb1 * bas + b[i]) % mod1, pb2 = (pb2 * bas + b[i]) % mod2;
  inv1 = po(po(bas, n, mod1) + mod1 - 1, mod1 - 2, mod1);
  inv2 = po(po(bas, n, mod2) + mod2 - 1, mod2 - 2, mod2);
  for (int i = n; i >= 0; i--) {
    long long t1 = ((pa1 + pb1) + (sa1 + mod1 - sb1)) % mod1;
    long long x1 = (bas - 1) * t1 % mod1 * inv1 % mod1;
    long long t2 = ((pa2 + pb2) + (sa2 + mod2 - sb2)) % mod2;
    long long x2 = (bas - 1) * t2 % mod2 * inv2 % mod2;
    if (x1 == x2 && x1 < m) ans[++tp] = x1;
    pa1 = (pa1 + mod1 - a[i] * mi1[i - 1] % mod1) % mod1;
    pa2 = (pa2 + mod2 - a[i] * mi2[i - 1] % mod2) % mod2;
    sa1 = (sa1 + a[i] * mi1[i - 1]) % mod1;
    sa2 = (sa2 + a[i] * mi2[i - 1]) % mod2;
    pb1 = (pb1 + mod1 - a[i]) * 750000005 % mod1;
    pb2 = (pb2 + mod2 - a[i]) * 166666668 % mod2;
    sb1 = (sb1 * 750000005 + mi1[n - 1] * (m - a[i])) % mod1;
    sb2 = (sb2 * 166666668 + mi2[n - 1] * (m - a[i])) % mod2;
  }
  printf("%d\n", tp);
  sort(ans + 1, ans + tp + 1);
  for (int i = 1; i <= tp; i++) printf("%lld ", ans[i]);
  return 0;
}
