#include <bits/stdc++.h>
using namespace std;
int a[200010], b[200010];
int n, m;
inline bool isprime(int x) {
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return 0;
  return 1;
}
unsigned long long hashseed;
unsigned long long h1[200010], h2[200010], t[200010];
inline void prehash() {
  for (int i = 1; i < n; i++)
    h1[i] = h1[i - 1] * hashseed + (unsigned long long)b[i];
  for (int i = n - 1; i; i--)
    h2[i] = h2[i + 1] * hashseed + (unsigned long long)b[i];
  t[0] = 1;
  for (int i = 1; i <= n; i++) t[i] = t[i - 1] * hashseed;
}
inline unsigned long long q1(int l, int r) {
  return h1[r] - h1[l - 1] * t[r - l + 1];
}
inline unsigned long long q2(int l, int r) {
  return h2[l] - h2[r + 1] * t[r - l + 1];
}
inline bool check(int l, int r) { return q1(l, r) == q2(l, r); }
set<int> ans;
int main() {
  srand(time(NULL));
  hashseed = rand() * rand();
  while (!isprime(hashseed)) hashseed++;
  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];
  prehash();
  bool flag;
  for (int i = 1; i <= n; i++) {
    flag = 1;
    if (i != 1 && !check(1, i - 1)) flag = 0;
    if (i != n) {
      if (a[1] + a[i] + m != a[i + 1] + a[n]) flag = 0;
      if (i != n - 1 && !check(i + 1, n - 1)) flag = 0;
    }
    if (flag) ans.insert((a[1] + a[i]) % m);
  }
  cout << ans.size() << endl;
  for (set<int>::iterator it = ans.begin(); it != ans.end(); it++)
    printf("%d ", *it);
}
