#include #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #define all(x)(x).begin(),(x).end() //#pragma GCC optimize("-O3") using namespace std; typedef long long ll;const int inf=INT_MAX/2;const ll infl=1LL<<60; templatebool chmax(T& a,const T& b){if(abool chmin(T& a,const T& b){if(b struct ModInt{ static const int Mod=MOD;unsigned x;ModInt():x(0){} ModInt(signed sig){x=sig<0 ? sig%MOD+MOD:sig%MOD;} ModInt(signed long long sig){x=sig<0 ? sig%MOD+MOD:sig%MOD;} int get() const{return(int)x;} ModInt& operator+=(ModInt that){if((x+=that.x)>=MOD) x-=MOD;return *this;} ModInt& operator-=(ModInt that){if((x+=MOD-that.x)>=MOD) x-=MOD;return *this;} ModInt& operator*=(ModInt that){x=(unsigned long long)x*that.x%MOD;return *this;} ModInt& operator/=(ModInt that){return *this*=that.inverse();} ModInt operator+(ModInt that) const{return ModInt(*this)+=that;} ModInt operator-(ModInt that) const{return ModInt(*this)-=that;} ModInt operator*(ModInt that) const{return ModInt(*this)*=that;} ModInt operator/(ModInt that) const{return ModInt(*this)/=that;} ModInt inverse() const{ long long a=x,b=MOD,u=1,v=0; while(b){long long t=a/b;a-=t*b;std::swap(a,b);u-=t*v;std::swap(u,v);} return ModInt(u); } bool operator==(ModInt that) const{return x==that.x;} bool operator!=(ModInt that) const{return x != that.x;} ModInt operator-() const{ModInt t;t.x=x==0 ? 0:Mod-x;return t;} }; template ostream& operator<<(ostream& st,const ModInt a){st< ModInt operator^(ModInt a,unsigned long long k){ ModInt r=1;while(k){if(k & 1) r*=a;a*=a;k >>= 1;}return r; } typedef ModInt<1000000007> mint; template struct FormalPowerSeries{ using Poly=vector; using Conv=function; Conv conv; FormalPowerSeries(Conv conv) :conv(conv){} Poly pre(const Poly& as,int deg){ return Poly(as.begin(),as.begin()+min((int)as.size(),deg)); } Poly add(Poly as,Poly bs){ int sz=max(as.size(),bs.size()); Poly cs(sz,T(0)); for(int i=0;i<(int)as.size();i++) cs[i]+=as[i]; for(int i=0;i<(int)bs.size();i++) cs[i]+=bs[i]; return cs; } Poly sub(Poly as,Poly bs){ int sz=max(as.size(),bs.size()); Poly cs(sz,T(0)); for(int i=0;i<(int)as.size();i++) cs[i]+=as[i]; for(int i=0;i<(int)bs.size();i++) cs[i]-=bs[i]; return cs; } Poly mul(Poly as,Poly bs){ return conv(as,bs); } Poly mul(Poly as,T k){ for(auto& a:as) a*=k; return as; } // F(0) must not be 0 Poly inv(Poly as,int deg){ assert(as[0] != T(0)); Poly rs({ T(1)/as[0] }); for(int i=1;i as.size()) return Poly(); reverse(as.begin(),as.end()); reverse(bs.begin(),bs.end()); int need=as.size()-bs.size()+1; Poly ds=pre(mul(as,inv(bs,need)),need); reverse(ds.begin(),ds.end()); ds.resize(a+b-1);// return ds; } // F(0) must be 1 Poly sqrt(Poly as,int deg){ assert(as[0]==T(1)); T inv2=T(1)/T(2); Poly ss({ T(1) }); for(int i=1;i T extgcd(T a,T b,T& x,T& y){for(T u=y=1,v=x=0;a;){T q=b/a;swap(x-=q*u,u);swap(y-=q*v,v);swap(b-=q*a,a);}return b;} template T mod_inv(T a,T m){T x,y;extgcd(a,m,x,y);return(m+x%m)%m;} ll mod_pow(ll a,ll n,ll mod){ll ret=1;ll p=a%mod;while(n){if(n & 1) ret=ret*p%mod;p=p*p%mod;n >>= 1;}return ret;} struct MathsNTTModAny{ template class NTT{ public: int get_mod() const{return mod;} void _ntt(vector& a,int sign){ const int n=sz(a); assert((n ^(n & -n))==0);//n=2^k const int g=3;//g is primitive root of mod int h=(int)mod_pow(g,(mod-1)/n,mod);// h^n=1 if(sign==-1) h=(int)mod_inv(h,mod);//h=h^-1%mod //bit reverse int i=0; for(int j=1;j> 1;k >(i ^= k);k >>= 1); if(j=mod) a[s]-=mod; a[s+m]=u-d; if(a[s+m]<0) a[s+m]+=mod; } w=w*base%mod; } } for(auto& x:a) if(x<0) x+=mod; } void ntt(vector& input){ _ntt(input,1); } void intt(vector& input){ _ntt(input,-1); const int n_inv=mod_inv(sz(input),mod); for(auto& x:input) x=x*n_inv%mod; } vector convolution(const vector& a,const vector& b){ int ntt_size=1; while(ntt_size _a=a,_b=b; _a.resize(ntt_size);_b.resize(ntt_size); ntt(_a); ntt(_b); FOR(i,ntt_size){ (_a[i]*=_b[i])%=mod; } intt(_a); return _a; } }; ll garner(vector> mr,int mod){ mr.emplace_back(mod,0); vector coffs(sz(mr),1); vector constants(sz(mr),0); FOR(i,sz(mr)-1){ // coffs[i]*v+constants[i]==mr[i].second(mod mr[i].first) ll v=(mr[i].second-constants[i])*mod_inv(coffs[i],mr[i].first)%mr[i].first; if(v<0) v+=mr[i].first; for(int j=i+1;j NTT_1; typedef NTT<469762049,3> NTT_2; typedef NTT<1224736769,3> NTT_3; vector solve(vector a,vector b,int mod=1000000007){ for(auto& x:a) x%=mod; for(auto& x:b) x%=mod; NTT_1 ntt1;NTT_2 ntt2;NTT_3 ntt3; assert(ntt1.get_mod()(m1,m2); const ll m12_inv_m3=mod_inv(m1*m2,m3); const ll m12_mod=m1*m2%mod; vector ret(sz(x)); FOR(i,sz(x)){ ll v1=(y[i]-x[i])*m1_inv_m2%m2; if(v1<0) v1+=m2; ll v2=(z[i]-(x[i]+m1*v1)%m3)*m12_inv_m3%m3; if(v2<0) v2+=m3; ll constants3=(x[i]+m1*v1+m12_mod*v2)%mod; if(constants3<0) constants3+=mod; ret[i]=constants3; } return ret; } vector solve(vector a,vector b,int mod=1000000007){ vector x(all(a)); vector y(all(b)); auto z=solve(x,y,mod); vector res; fore(aa,z) res.push_back(aa%mod); return res; } vector solve(vector a,vector b,int mod=1000000007){ int n=a.size(); vector x(n); rep(i,0,n) x[i]=a[i].get(); n=b.size(); vector y(n); rep(i,0,n) y[i]=b[i].get(); auto z=solve(x,y,mod); vector res; fore(aa,z) res.push_back(aa%mod); vector res2; fore(x,res) res2.push_back(x); return res2; } }; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); using T=mint; FormalPowerSeries FPS([&](auto a,auto b){ MathsNTTModAny ntt; return ntt.solve(a,b); }); int k,n; cin>>k>>n; vector f(k+1); rep(i,0,n){ int x; cin>>x; f[x]=-1; } f[0]=f[0]+1; f=FPS.inv(f,k+1); cout<