#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mod = 998244353;
int main() {
  ll n, s;
  cin >> n >> s;
  vector<ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<vector<ll>> dp(n, vector<ll>(s, 0));
  dp[0][a[0] - 1] = 1;
  for (int i = 1; i < n; ++i) {
    if (a[i] <= s) dp[i][a[i] - 1]++;
    for (int j = 0; j < s; ++j) {
      dp[i][j] += dp[i - 1][j];
      if (j - a[i] >= 0) dp[i][j] += dp[i - 1][j - a[i]];
      dp[i][j] %= mod;
    }
    cerr << endl;
  }
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      ans += dp[j][s - 1];
      if (i > 0) {
        ans -= dp[i - 1][s - 1];
        if (a[i] < s) ans -= dp[i - 1][s - 1 - a[i]];
      }
      if (ans >= mod) ans -= mod;
    }
  }
  cout << ans << endl;
  return 0;
}
