#include <bits/stdc++.h>
const long long MODN = 998244353;
const long long MAXN = 3010;
using namespace std;
long long dp[MAXN][MAXN];
int32_t main() {
  dp[0][0] = 1;
  long long n, k;
  cin >> n >> k;
  vector<long long> arrmv(n + 1);
  for (long long i = 0; i < n; i++) cin >> arrmv[i + 1];
  vector<long long> a = arrmv;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (k - a[i] >= 0) {
      if (k - a[i] > 0)
        ans += dp[i - 1][k - a[i]] * (n - i + 1);
      else
        ans += i * (n - i + 1);
      ans %= MODN;
    }
    for (long long j = 0; j <= k; j++) {
      dp[i][j] += dp[i - 1][j];
      if (j - a[i] > 0)
        dp[i][j] += dp[i - 1][j - a[i]];
      else if (j == a[i])
        dp[i][j] += i;
    }
  }
  cout << ans << endl;
  return 0;
}
