#include #define ALL(v) std::begin(v),std::end(v) using lint=long long; using ld=long double; #define ENABLE_DEBUG 0 #ifdef NGTKANA #include #else #define DEBUG(...)(void)0 #endif lint mod=1'000'000'007; lint inverse(lint x){ assert(x%mod); lint y=1,u=mod,v=0; while(x){lint q=u/x;u-=q*x;std::swap(u,x);v-=q*y;std::swap(v,y);} assert(x==0&&std::abs(u)==1&&std::abs(y)==mod&&std::abs(v)>=1){if(y&1)z*=x;x*=x;}return z;} mint operator-(mint x){return mint(-x.value);} using poly_t=std::vector; struct resring{ lint deg; poly_t mod, qd, qinv; resring()=default; resring(poly_t v):deg(v.size()-1),mod(v), qd([v=v]()mutable{mint x=1/v.back();v.pop_back();for(mint&y:v)y*=-x;return v;}()), qinv([v=v]()mutable{v.erase(v.begin());for(mint&x:v)x=-x;return v;}()){} poly_t&normalize(poly_t&a)const{ DEBUG("n",deg,a); for(;deg>=1){if(b&1)mul_assign(ans,a);mul_assign(a,a);}return ans;} }; mint bruteforce(lint w,lint k,std::vector a){ std::vectordp(w*k+1); dp.at(0)=1; for(lint i=0;i<=w*k;i++){ for(lint x:a){ if(w*k>n>>w>>k; std::vectordp(w+w+1); dp.at(0)=1; std::vectora(n); for(lint&x:a)std::cin>>x; for(lint i=0;i<=w+w;i++){ for(lint x:a){ if(w+w