#include <bits/stdc++.h>
using namespace std;
#define int 					long long
//#define double 					long double
#define max(x,y) 				(((x)>(y))?(x):(y))
#define min(x,y) 				(((x)<(y))?(x):(y))
#define all(v) 					v.begin(),v.end()
#define vi 						vector<int>
#define MOD 					1000000007
#define inf 					1e18
#define ps(num,precision) 		fixed<<setprecision(precision)<<num
#define md(arr,n,type) 			type *arr=new type[n]

 
void inout(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}
 
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
 
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
 
void SieveOfEratosthenes(int n){
	bool prime[n+1];
	memset(prime,true,sizeof(prime));
	for(int p=2;p*p<=n;p++){
		if(prime[p]){
			for(int i=p*p;i<=n;i+=p){
				prime[i]=false;
			}
		}
	}
 
	for(int i=2;i<=n;i++){
		if(prime[i]){
		}
	}
}
int printDivisors(int n) 
{ 
	int sum=0;
    for (int i=1; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            if (n/i == i) 
                sum+=1;
            else{ 
                sum+=2;
            }
        } 
    } 
    return sum;
}

void solve(){
    int n;
	cin>>n;
	int a[n];
	int min;
	int ans=0;
	int con=0;
	vector<pair<int,int>> b;
	for(int i=0;i<n;i++){
		cin>>a[i];
		b.push_back(make_pair(a[i],i));
	}
	sort(all(b));
	for(int i=0;i<n;i++){
		min=a[i];
		if(ans<a[i]){
			ans=a[i];
		}
		for(int j=i+1;j<n;j++){
			if(min>a[j]){
				min=a[j];
			}
			if((j-i+1)*min>ans){
				ans=(j-i+1)*min;
			}
		}
	}
	cout<<ans;
}
int32_t main(){
	//inout();
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
//#define int long long
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PI = pair<pair<int,int>,int>;
using PL = pair<long long, long long>;
using PLL = pair<pair<long long, long long>, long long>;
using Pxy = pair<double, double>;
using Tiib = tuple<int, int, bool>;
const int INF = 1001001007;
const int modd = 1000000007;
const long long modl = 1000000007LL;
const int mod = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

void no (){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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;
  }
};

mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

int main(){
    int n, k; cin >> n >> k;
    vector<mint> ar(n,0LL);
    rep(i,n){
        ll a; cin >> a;
        mint b = a;
        ar[i] += b;
    }
    vector<mint> tab(k+1);
    vector<mint> gya(k+1,1LL);
    vector<mint> ars(n,1LL);
    rep(i,k){
        mint c = ll(i + 1);
        gya[i+1] = gya[i] / c;
    }
    rep(i,k+1){
        mint c = 0LL;
        rep(j,n){
            c += ars[j];
            ars[j] *= ar[j];
        }
        tab[i] = c * gya[i];
    }
    mint kai = 1LL;
    mint ni = 2LL;
    repp(i,k+1,1){
        mint x = ll(i);
        kai *= x;
        mint ans = 0LL;
        rep(j,i+1){
            ans += tab[j] * tab[i-j];
        }
        ans *= kai;
        ans -= f(i) * tab[i] * kai;
        ans /= ni;
        cout << ans.x << endl;
    }
}