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

const int maxn = 200005;
const int maxk = 302;
const long long mod = 998244353;

long long add_mod (long long a, long long b) {
	return (a + b) % mod;
}

long long sub_mod (long long a, long long b) {
	return (a + mod - b) % mod;
}

long long mul_mod (long long a, long long b) {
	return (a * b) % mod;
}

long long pow_mod (long long a, long long b) {
	long long res = 1LL, t = a;
	while (b) {
		if (b & 1)
			res = mul_mod(res, t);
		t = mul_mod(t, t);
		b >>= 1;
	}
	return res;
}

long long div_mod (long long a, long long b) {
	return mul_mod(a, pow_mod(b, mod - 2));
}

long long ncr_mod[maxk][maxk];

void precalc () {
	for (int n = 0; n < maxk; ++n) {
		for (int r = 0; r < maxk; ++r) {
			if (n == 0 || r == 0 || n == r)
				ncr_mod[n][r] = 1LL;
			else
				ncr_mod[n][r] = add_mod(ncr_mod[n - 1][r], ncr_mod[n - 1][r - 1]);
		}
	}
}

long long a[maxn];
long long s[maxk], diff[maxk];

int32_t main () {
	precalc();
	
	int n, k;
	scanf("%d %d", &n, &k);
	
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
		long long cur = 1LL, cur_d = 1LL;
		for (int x = 0; x <= k; ++x) {
			s[x] = add_mod(s[x], cur);
			diff[x] = add_mod(diff[x], cur_d);
			cur = mul_mod(cur, a[i]);
			cur_d = mul_mod(cur_d, mul_mod(2LL, a[i]));
		}
	}
	
	for (int x = 1; x <= k; ++x) {
		long long ans = 0LL;
		for (int j = 0; j <= x; ++j) 
			ans = add_mod(ans, mul_mod(s[x - j], mul_mod(ncr_mod[x][j], s[j])));
		ans = div_mod(sub_mod(ans, diff[x]), 2LL);
		printf("%lld\n", ans);
	}
}

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */


#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class EPeddler {
public:

    vector<int> graph[200005];

    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n, m; cin >> n >> m;
      vector<ll> a(n);
      rep(i, n) {
        cin >> a[i];
      }
      vector<int> x(m), y(m);
      rep(i, m) {
        cin >> x[i] >> y[i];
        x[i]--; y[i]--;
        graph[x[i]].push_back(y[i]);
      }

      vector<ll> dp(n, LLONG_MIN/2);
      vector<ll> lowest(n, LLONG_MAX/2);

      for(int i=0; i<n; i++) {
        for(auto e: graph[i]) {
          chmin(lowest[e], lowest[i]);
          chmin(lowest[e], a[i]);
        }
      }

      ll ret = LLONG_MIN/2;
      for(int i=0; i<n; i++) {
        chmax(ret, a[i] - lowest[i]);
      }

      cout << ret << endl;
    }
};

signed main() {
  EPeddler solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}