#include <bits/stdc++.h>
using namespace std;
const int maxN = 200005;
const unsigned long long HA = 41793404541;
int n, m;
int a[maxN], b[maxN];
unsigned long long fac[maxN], pre[maxN], nxt[maxN];
int ansn, ans[maxN];
bool check(int l, int r) {
  return pre[r] - pre[l - 1] * fac[r - l + 1] ==
         nxt[l] - nxt[r + 1] * fac[r - l + 1];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i < n; ++i) b[i] = a[i + 1] - a[i];
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * HA;
  for (int i = 1; i <= n; ++i)
    pre[i] = pre[i - 1] * HA + (unsigned long long)b[i];
  for (int i = n - 1; i; --i)
    nxt[i] = nxt[i + 1] * HA + (unsigned long long)b[i];
  for (int i = 1; i <= n; ++i) {
    bool pd = true;
    if (i != 1) pd &= check(1, i - 1);
    if (i != n) {
      pd &= (a[1] + a[i] == a[i + 1] + a[n] - m);
      if (i != n - 1) pd &= check(i + 1, n - 1);
    }
    if (pd) ans[++ansn] = (a[1] + a[i]) % m;
  }
  printf("%d\n", ansn);
  sort(ans + 1, ans + ansn + 1);
  for (int i = 1; i <= ansn; ++i) printf("%d ", ans[i]);
  return 0;
}
