#include using namespace std; typedef long long ll; typedef long double ld; typedef pair P; typedef pair Pi; #define rep(i,n) for(ll i=0;i inline bool chmax(T &a, T b){if(a inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;} template ostream& operator<<(ostream& s,const complex& d) {return s<<"("< ostream& operator<<(ostream& s,const pair& d) {return s<<"("< ostream& operator<<(ostream& s, const vector& d){int len=d.size();rep(i,len){s< ostream& operator<<(ostream& s,const vector>& d){int len=d.size();rep(i,len){s< ostream& operator<<(ostream& s,const set& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template ostream& operator<<(ostream& s,const multiset& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template ostream& operator<<(ostream& s,const map& m){s<<"{"<>(istream& is,mint& a){ ll t; is>>t; a=mint(t); return (is); } mint& operator+=(const mint a){ if((x+=a.x)>=mod) x-=mod; return *this; } mint& operator-=(const mint a){ if((x+=mod-a.x)>=mod)x-=mod; return *this; } mint& operator*=(const mint a){ (x*=a.x)%=mod; return *this; } mint operator+(const mint a) const{ mint res(*this); return res+=a; } mint operator-(const mint a) const{ mint res(*this); return res-=a; } mint operator*(const mint a) const{ mint res(*this); return res*=a; } mint pow(ll t) const{ if (!t) return 1; mint a=pow(t>>1); a*=a; if(t&1) a*=*this; return a; } // for prime mod mint inv() const{ return pow(mod-2); } mint& operator/=(const mint a){ return (*this)*=a.inv(); } mint operator/(const mint a) const{ mint res(*this); return res/=a; } }; struct combination{ vector fact,ifact; combination(int n):fact(n+1),ifact(n+1){ assert(n=1;i--) ifact[i-1]=ifact[i]*i; } mint operator()(int n,int k){ if (k<0 || k>n) return 0; return fact[n]*ifact[k]*ifact[n-k]; } }; int main(){ cin.tie(0);ios::sync_with_stdio(false); int n,q; cin>>n>>q; vector a(n); rep(i,n){ cin>>a[i]; } vector> dp(n+1,vector(n+1,0)); dp[0][0]=1; rep(i,n)rep(j,n+1){ dp[i+1][j]=dp[i][j]*(a[i]-1); if(j) dp[i+1][j]+=dp[i][j-1]; } while(q--){ int b; cin>>b; cout<