//KZNS
//Best Wil
#include <cstdio>
#include <algorithm>
using namespace std;
int p[5] = {11261, 19997, 22877, 21893, 14843};
int a[105][5] = {0};
int ls[1000003] = {0};
int N, M;
void rin() {
scanf("%d %d", &N, &M);
char c;
int f;
for (int i = 0; i <= N; i++) {
f = 1;
c = getchar();
while (!('0' <= c && c <= '9')) {
if (c == '-')
f = -1;
c = getchar();
}
while ('0' <= c && c <= '9') {
for (int k = 0; k < 5; k++)
a[i][k] = (a[i][k]*10+c-'0')%p[k];
c = getchar();
}
for (int k = 0; k < 5; k++)
a[i][k] *= f;
}
}
bool ck(int t, int k) {
int u = 1;
int ans = 0;
for (int i = 0; i <= N; i++) {
ans = (ans + a[i][k]*u)%p[k];
u = u*t%p[k];
}
if (ans)
return false;
else
return true;
}
int anls[1000003] = {0};
int anu = 0;
void work() {
int mn;
int u;
for (int k = 0; k < 5; k++) {
mn = min(M, p[k]);
for (int i = 1; i <= mn; i++) {
if (ck(i, k)) {
ls[i]++;
u = i;
while (u + p[k] <= M) {
u += p[k];
ls[u]++;
}
}
}
}
for (int i = 1; i <= M; i++) {
if (ls[i] == 5)
anls[anu++] = i;
}
printf("%d\n", anu);
for (int i = 0; i < anu; i++)
printf("%d\n", anls[i]);
}
int main() {
freopen("equationa.in", "r", stdin);
freopen("equationa.out", "w", stdout);
rin();
work();
return 0;
}
//All Illu
//UBWH