#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
long long MOD = 998244353;
void solve() {
  long long n, s;
  cin >> n >> s;
  vector<long long> val(n);
  for (long long i = 0; i < n; i++) {
    cin >> val[i];
  }
  long long dp[3030][3030];
  for (long long i = 0; i < n; i++) {
    for (long long j = 1; j < s + 1; j++) {
      dp[i][j] = 0;
      dp[i][j] += dp[i - 1][j];
      dp[i][j] %= MOD;
      if (j - val[i] > 0) {
        dp[i][j] += dp[i - 1][j - val[i]];
        dp[i][j] %= MOD;
      }
      if (j - val[i] == 0) dp[i][j] += i + 1;
      dp[i][j] %= MOD;
    }
  }
  long long ans = 0;
  ans += ((dp[0][s] * n) % MOD);
  ans %= MOD;
  for (long long i = 1; i < n; i++) {
    ans += (((dp[i][s] - dp[i - 1][s] + MOD) * (n - i)) % MOD);
    ans %= MOD;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
