#include <bits/stdc++.h>
using namespace std;
const int N = 3333;
int a[N];
long long dp[N][N];
const long long mod = 998244353;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, s;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int v = a[i]; v <= s; v++) {
      dp[v][i] = dp[v][i - 1] + dp[v - a[i]][i - 1];
      dp[v][i] %= mod;
    }
  }
  for (int j = 1; j <= n; j++) {
    for (int i = j; i <= n; i++) {
      ans += dp[s][i];
      ans %= mod;
    }
    for (int v = s; v >= a[j]; v--) {
      dp[v][j] -= dp[v - a[j]][j - 1];
      dp[v][j] = (dp[v][j] % mod + mod) % mod;
    }
  }
  cout << ans << endl;
  return 0;
}
