#ifndef DEBUG constint N = 2e6 + 10; #else constint N = 17; #endif constint mod = 998244353;
int n, k; int s[N], a[N], maxn[N]; deque <int> q;
signedmain() { cin >> n >> k; for (int i = 1; i <= n; i++){ cin >> a[i]; } for (int i = n + 1; i <= 2 * n; i++) a[i] = a[i - n]; for (int i = 1; i <= 2 * n; i++) s[i] = s[i - 1] + a[i];
int res = 0; for (int i = 1; i <= 2 * n; i++)//单调队列 { while (q.size () && q.front () + n <= i) q.pop_front (); while (q.size () && q.back () && s[i] <= s[q.back ()]) q.pop_back (); q.push_back (i); if (i > n && s[q.front()] > s[i - n]) res++; } for (int i = 1; i <= k; i++) { res *= res; res %= mod; } cout << res; }