#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
ll t1, t2, t3;
const ll mod = 998244353;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x, ll *y) {
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
int main() {
  ll n, s;
  ll ans = 0;
  cin >> n >> s;
  vector<ll> vec(n);
  vector<vector<ll>> dp(n, vector<ll>(s + 1));
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      dp[i][vec[i]] = 1;
      continue;
    }
    t1 = vec[i];
    for (int j = 0; j < s + 1; j++) {
      if (j - t1 >= 0) {
        dp[i][j] += dp[i - 1][j - t1];
      }
      dp[i][j] += dp[i - 1][j];
    }
  }
  vector<ll> sum(s, 0), calc(n, 0);
  for (int i = 0; i < s; i++) {
    for (int j = 0; j < n; j++) {
      sum[i] += dp[j][i];
    }
  }
  for (int i = 0; i < n; i++) {
    calc[i] += sum[s - vec[i]];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      ans += calc[j] + mod;
      if (i > 0) {
        ans -= calc[i - 1];
      }
      ans %= mod;
    }
  }
  cout << ans << endl;
}
