#include <bits/stdc++.h>
using namespace std;
const long long N = 3005;
const long long Inf = 2e9 + 7;
const long long MOD = 998244353;
long long n, s, a[N];
long long dp[N][N], ans[N][N];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cerr.tie(NULL);
  cin >> n >> s;
  for (long long i = 0; i <= n; ++i) {
    dp[i][0] = 1;
  }
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  long long anss = 0;
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= 3000; ++j) {
      if (j >= a[i]) dp[i][j] = dp[i - 1][j] + dp[i - 1][j - a[i]];
      dp[i][j] %= MOD;
    }
    for (long long j = i - 1; j >= 0; --j) {
      if (s >= a[i]) ans[j][i] = ans[1][i] - ans[1][j] - dp[j - 1][s - a[i]];
      ans[i][j] %= MOD;
    }
  }
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= n; ++j) {
      anss += ans[i][j];
      anss %= MOD;
    }
  }
  cout << anss;
}
