#include <bits/stdc++.h>
using namespace std;
const int sz = 2e5 + 5;
int n, m, a[sz], ara[sz];
const int p1 = 1e9 + 3, p2 = 1e9 + 9, pinv = 166666668;
int vmod[sz], invmod[sz], soja[sz], baka[sz];
void prc() {
  for (int i = 0; i < n; i++) {
    soja[i] = 1LL * a[i] * vmod[i] % p2;
    i ? soja[i] += soja[i - 1] : i;
    soja[i] >= p2 ? soja[i] -= p2 : p2;
  }
  reverse(a, a + n);
  for (int i = 0; i < n; i++) {
    baka[i] = 1LL * a[i] * vmod[i] % p2;
    i ? baka[i] += baka[i - 1] : i;
    baka[i] >= p2 ? baka[i] -= p2 : p2;
  }
  reverse(baka, baka + n);
}
int sval(int i, int j) {
  int rtv = soja[j];
  i ? rtv -= soja[i - 1] : i;
  rtv < 0 ? rtv += p2 : p2;
  rtv = 1LL * rtv * invmod[i] % p2;
  return rtv;
}
int bval(int i, int j) {
  int rtv = baka[i];
  j < n - 1 ? rtv -= baka[j + 1] : j;
  rtv < 0 ? rtv += p2 : p2;
  rtv = 1LL * rtv * invmod[n - 1 - j] % p2;
  return rtv;
}
bool ispal(int i, int j) {
  if (i >= j) return 1;
  return sval(i, j) == bval(i, j);
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) scanf("%d", &ara[i]);
  for (int i = 0; i < n - 1; i++) a[i] = ara[i + 1] - ara[i];
  n--;
  vmod[0] = invmod[0] = 1;
  for (int i = 1; i < sz; i++) vmod[i] = 1LL * vmod[i - 1] * p1 % p2;
  for (int i = 1; i < sz; i++) invmod[i] = 1LL * invmod[i - 1] * pinv % p2;
  prc();
  vector<int> ans;
  for (int i = 0; i <= n; i++) {
    if (ispal(0, i - 1)) {
      if (i == n)
        ans.push_back((ara[0] + ara[i]) % m);
      else if (ara[0] + ara[i] == ara[i + 1] + ara[n] - m &&
               ispal(i + 1, n - 1))
        ans.push_back(ara[0] + ara[i]);
    }
  }
  printf("%d\n", ans.size());
  sort(ans.begin(), ans.end());
  for (int x : ans) printf("%d ", x);
}
