#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long md = 998244353) {
  long long res = 1;
  x %= md;
  while (y) {
    if (y & 1) res = (res * x) % md;
    x *= x;
    if (x >= md) x %= md;
    y >>= 1;
  }
  return res;
}
using namespace std;
long long dp[3001][3001];
long long dp1[3001][3001];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, second;
  cin >> n >> second;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= second; j++) dp[i][j] = dp[i - 1][j];
    for (long long j = 0; j <= second; j++) {
      if (j - a[i - 1] >= 0) dp[i][j] += dp[i - 1][j - a[i - 1]];
    }
  }
  long long ans = 0;
  for (long long i = n; i > 0; i--) {
    if (second - a[i - 1] > 0) {
      dp1[i - 1][second - a[i - 1]] += (n + 1 - i);
    } else if (second - a[i - 1] == 0) {
      ans += (n + 1 - i) * (i);
      ans %= 998244353;
    }
    for (long long j = second - 1; j > 0; j--) {
      if (dp1[i][j] == 0) continue;
      if (j - a[i - 1] > 0)
        dp1[i - 1][j - a[i - 1]] += dp1[i][j];
      else if (j - a[i - 1] == 0) {
        ans += dp1[i][j] * (i);
        ans %= 998244353;
      }
      dp1[i - 1][j] += dp1[i][j];
    }
  }
  cout << ans;
}
