#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using P = pair<int, int>;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const ll LINF = (ll)1e18;
template <class t, class u>
void chmax(t& a, u b) {
  if (a < b) a = b;
}
template <class t, class u>
void chmin(t& a, u b) {
  if (b < a) a = b;
}
const int mod = 998244353;
int main() {
  int n, s;
  cin >> n >> s;
  vi a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vl one(n + 1);
  one[0] = 0;
  for (int i = 0; i < (int)(n); i++) one[i + 1] += one[i] + a[i];
  ll ans = 0;
  for (int i = 0; i < (int)(n); i++) {
    for (int j = i + 1; j <= n; j++) {
      if (one[j] - one[i] == s) {
        ll t = (ll)((i + 1) * (n - j + 1)) % mod;
        cout << one[j] << " " << one[i] << " " << t << endl;
        ans = (ans + t) % mod;
      }
    }
  }
  cout << ans << endl;
}
