### [BZOJ3751][NOIP2014][数学][乱搞]解方程

Description

Input

Output

Sample Input
2 10
2
-3
1
Sample Output
2
1
2
HINT

``#include<cstdio>#include<cstring>using namespace std;const int maxn=100+5,maxm=1e6+5;const int prime[5]={23333,19997,22877,21893,14843};int n,m,num[6][maxn],pow[6][maxn],ans[maxm],res[6][maxm];char ch[maxn];int cal(int mod){    int sum=0;    for(int i=0;i<=n;i++)        sum=(sum+num[mod][i]*pow[mod][i])%prime[mod];    if(sum<0)sum+=prime[mod];    return sum;}bool judge(int x){    for(int i=0;i<5;i++)        if(res[i][x%prime[i]]!=0) return false;    return true;}int main(){    scanf("%d%d",&n,&m);    for (int i=0;i<=n;i++)    {        getchar(); scanf("%s",ch);        int flag=ch[0]=='-'?-1:1,len=strlen(ch);        for (int j=0;j<5;j++)        {            if (flag==1) num[j][i]=ch[0]-'0';            for (int k=1;k<len;k++) num[j][i]=(num[j][i]*10+ch[k]-'0')%prime[j];            num[j][i]*=flag;        }    }    for (int i=0;i<5;i++)      for (int j=1;j<prime[i];j++)      {        pow[i][0]=1;        for(int k=1;k<=n;k++) pow[i][k]=(pow[i][k-1]*j)%prime[i];        res[i][j]=cal(i);      }    for(int i=1;i<=m;i++) if(judge(i)) ans[++ans[0]]=i;    printf("%d\n",ans[0]);    for(int i=1;i<=ans[0];i++) printf("%d\n",ans[i]);    return 0;}``