#include<cstdio> #include<list> constint MAXN = 105; constint MAXM = 1000005; constint MAXLEN = 10005; constint PRIME_NUM = 2; constint MODS[PRIME_NUM] = {21893, 18341629}; int n, m; int a[MAXN]; char s[MAXN][MAXLEN]; intparseInt(char *s, int mod){ int sgn = 1, res = 0; if (*s == '-') sgn = -1, s++; for (; *s; s++) res = (res * 10 + *s - '0') % mod; return res * sgn; } intcalc(int x, int mod){ longlong res = 0, pow = 1; for (int i = 0; i <= n; i++) { res = (res + a[i] * pow) % mod; pow = pow * x % mod; } return (int) res; } intmain(){ scanf("%d %d", &n, &m); for (int i = 0; i <= n; i++) scanf("%s", s[i]); std::list<int> roots; int p = MODS[0]; for (int i = 0; i <= n; i++) a[i] = parseInt(s[i], p); for (int i = 1; i < p; i++) { int y = calc(i, p); if (y == 0) for (int j = i; j <= m; j += p) roots.push_back(j); } for (int i = 1; i < PRIME_NUM; i++) { int p = MODS[i]; for (int j = 0; j <= n; j++) a[j] = parseInt(s[j], p); for (std::list<int>::iterator it = roots.begin(); it != roots.end(); ) { int y = calc(*it, p); if (y != 0) it = roots.erase(it); else it++; } } roots.sort(); printf("%lu\n", roots.size()); for (std::list<int>::iterator it = roots.begin(); it != roots.end(); it++) printf("%d\n", *it); return0; }