#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
long long MOD = 998244353;
long long exp(long long n, long long e) {
  if (e == 0) return 1;
  long long temp = exp((n * n) % MOD, e / 2);
  return e % 2 == 0 ? temp : (temp * n) % MOD;
}
bool check(string s) {
  for (int i = 0; i < ((long long)(s).size()); i++) {
    if (s[i] != s[((long long)(s).size()) - i - 1]) return false;
  }
  return true;
}
int LIM = 3010;
vector<vector<long long> > dp(LIM, vector<long long>(LIM, 0));
void solve() {
  long long n, s;
  cin >> n >> s;
  vector<long long> arr(n + 1, 0);
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 1; i <= n; i++) {
    dp[i][arr[i]] = i;
    for (int j = 1; j <= s; j++) {
      dp[i][j] += dp[i - 1][j];
      if (j >= arr[i]) dp[i][j] += dp[i - 1][j - arr[i]];
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long temp = dp[i][s] - dp[i - 1][s] + MOD;
    temp %= MOD;
    temp = (temp * (n - i + 1)) % MOD;
    ans = (ans + temp) % MOD;
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
