#include <bits/stdc++.h>
using namespace std;
int a[200005], b[200005], res[200005];
unsigned long long base[200005], pre[200005], suf[200005];
bool check(int x, int y) {
  return pre[y] - pre[x - 1] * base[y - x + 1] ==
         suf[x] - suf[y + 1] * base[y - x + 1];
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    b[i - 1] = a[i] - a[i - 1];
  }
  base[0] = 1;
  for (int i = 1; i < n; ++i) base[i] = 131 * base[i - 1];
  for (int i = 1; i < n; ++i) pre[i] = pre[i - 1] * 131 + b[i];
  for (int i = n - 1; i >= 1; --i) suf[i] = suf[i + 1] * 131 + b[i];
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    if ((a[1] + a[i] == a[i + 1] + a[n] - m || i == n) &&
        (i == 1 || check(1, i - 1)) &&
        (i == n || i == n - 1 || check(i + 1, n - 1))) {
      ans++;
      res[ans] = (a[1] + a[i]) % m;
    }
  }
  sort(res + 1, res + 1 + ans);
  printf("%d\n", ans);
  for (int i = 1; i <= ans; ++i) printf("%d ", res[i]);
  return 0;
}
