#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD_VAL = 998244353;
int main() {
  int n, s;
  cin >> n >> s;
  int arr[n];
  for (int i = 0; i < (n); i++) cin >> arr[i];
  int dp[n + 1][s + 1];
  for (int i = 0; i < (n + 1); i++)
    for (int j = 0; j < (s + 1); j++) dp[i][j] = 0;
  dp[0][0] = 1;
  int ans = 0;
  for (int i = 0; i < (n); i++) {
    for (int j = 0; j < (s + 1); j++) dp[i + 1][j] = dp[i][j];
    for (int j = 0; j < (s); j++) {
      if (arr[i] + j <= s) dp[i + 1][arr[i] + j] = dp[i][arr[i] + j] + dp[i][j];
    }
    dp[i + 1][0] = dp[i][0] + 1;
    ans = (ans + dp[i + 1][s]) % MOD_VAL;
  }
  cout << ans << endl;
  return 0;
}
