#include<bits/stdc++.h>

using namespace std;

#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define PB push_back
#define MP make_pair
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef unsigned long long ull;
typedef double lf;
typedef long double Lf;
typedef pair<int, int> pii;

const int maxn = 2e5 + 5;
const int maxk = 305;
const int INF = 998244353;

class Number{
public:
	int dat;
	Number(){}
	Number(int dat_): dat(dat_){}
	inline Number&operator += (const Number &oth){ (dat += oth.dat) -= (dat >= INF ? INF : 0); return *this; }
	inline Number&operator -= (const Number &oth){ (dat -= oth.dat) += (dat < 0 ? INF : 0); return *this; }
	inline Number&operator *= (const Number &oth){ dat = 1ll * dat * oth.dat % INF; return *this; }
	inline Number operator + (const Number &oth)const{ Number ret = *this; ret += oth; return ret; }
	inline Number operator - (const Number &oth)const{ Number ret = *this; ret -= oth; return ret; }
	inline Number operator * (const Number &oth)const{ Number ret = *this; ret *= oth; return ret; }
}a[maxn], binom[maxk][maxk], pw[2][maxn], s[maxk];

const Number inv2 = (INF + 1) / 2;

int n, k;

inline void precalc(){
	int p = 0, q = 1;
	REP(i, 0, k){
		binom[i][0] = 1;
		REP(j, 1, i)
			binom[i][j] = binom[i - 1][j - 1] + binom[i - 1][j];
		FOR(j, 0, n){
			pw[q][j] = (!i ? 1 : pw[p][j] * a[j]);
			s[i] += pw[q][j];
		}
		swap(p, q);
	}
	return;
}

int main(){
	scanf("%d%d", &n, &k);
	FOR(i, 0, n)
		scanf("%d", &a[i].dat);
		
	precalc();
	
	REP(x, 1, k){
		Number ans = 0;
		REP(i, 0, x){
			Number res = s[i] * s[x - i] - s[x];
			ans += res * binom[x][i];
		}
		printf("%d\n", (ans * inv2).dat);
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); ++i)

ll INF = 1ll << 60;

int main(){
    ll n, q;
    cin >> n >> q;
    vl a(n);
    rep(i, 0, n){
        cin >> a[i];
    }
    vector<pll> k(q);
    rep(i, 0, q){
        ll t;
        cin >> t;
        k[i] = {t, i};
    }
    sort(k.begin(), k.end());

    vl ans(q);
    int id = 0;
    rep(i, 0, q){
        ll t = k[i].first;
        if(id == 0){
            if(a[0]-1 >= t){
                ans[k[i].second] = t;
                continue;
            }
        }
        while(id < n-1 && a[id+1]-(id+2) < t){
            id++;
        }
        ans[k[i].second] = t+id+1;
    }

    rep(i, 0, q){
        cout << ans[i] << endl;
    }

    
    return 0;
    
}