解方程
用秦九昭算法,枚举解即可
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define U(i,u) for(register int i=head[u];i;i=nxt[i])
#define rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define per(i,a,b) for(register int i=(a);i>=(b);--i)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll P=1000000007;
template<class T> inline void read(T &x){
x=0;char c=getchar();int f=1;
while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c)){x=(x*10+c-'0')%P;c=getchar();}x*=f;
}
template<class T> inline void cmin(T &x, T y){x=x<y?x:y;}
template<class T> inline void cmax(T &x, T y){x=x>y?x:y;}
const int N=101;
ll n,m,a[N],v;
VI ans;
int main(){
read(n);read(m);rep(i,0,n)read(a[i]);
for(ll i=1;i<=m;i++){
v=(a[n]*i+a[n-1])%P;
for(ll j=n-2;j>=0;j--){
v=(v*i+a[j])%P;
}
if(v==0)ans.pb(i);
}
if(!ans.size())printf("0");
else{
cout<<ans.size()<<endl;
rep(i,0,ans.size()-1){
printf("%d
",ans[i]);
}
}
return 0;
}