#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, s;
  cin >> n >> s;
  long long int a[n + 1];
  for (long long int i = 1; i <= n; i++) cin >> a[i];
  long long int dp[n + 1][s + 1][2];
  for (long long int i = 0; i <= s; i++) {
    dp[1][i][1] = 0;
    dp[1][i][0] = 0;
  }
  dp[1][a[1]][0] = dp[1][a[1]][1] = 1LL;
  for (long long int i = 2; i <= n; i++) {
    for (long long int j = 0; j < a[i]; j++) {
      dp[i][j][0] = 0;
      dp[i][j][1] = dp[i - 1][j][1];
    }
    dp[i][a[i]][0] = i;
    dp[i][a[i]][1] = (dp[i][a[i]][0] + dp[i - 1][a[i]][1]) % 998244353;
    for (long long int j = a[i] + 1; j <= s; j++) {
      dp[i][j][0] = dp[i - 1][j - a[i]][1];
      dp[i][j][1] = (dp[i - 1][j][1] + dp[i][j][0]) % 998244353;
    }
  }
  long long int ans = 0;
  for (long long int i = 1; i <= n; i++) {
    ans = (ans + (n - i + 1LL) * dp[i][s][0]) % 998244353;
  }
  cout << ans << "\n";
  return 0;
}
