#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const long long INF = 1e16;
const long long MAX_N = 100010;
int main() {
  long long n, S;
  cin >> n >> S;
  vector<long long> a(n + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<vector<long long>> dp(n + 1, vector<long long>(S + 1));
  dp[0][0] = 1;
  for (long long R = 1; R <= n; R++) {
    for (long long s = 0; s <= S; s++) {
      long long x = 0;
      if (s == 0 || s == a[R]) {
        x = 1;
      }
      if (s >= a[R]) {
        dp[R][s] = dp[R - 1][s] + dp[R - 1][s - a[R]] + x;
      } else {
        dp[R][s] = dp[R - 1][s] + x;
      }
      dp[R][s] %= mod;
    }
  }
  long long ans = 0;
  for (long long R = 1; R <= n; R++) {
    ans += dp[R][S];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
