#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<ll> dp(S + 1, 0);
  vector<ll> next(S + 1, 0);
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    (dp[0] += 1) %= 998244353;
    for (int j = 0; j <= S; j++)
      if (j + A[i] <= S) {
        (next[j] += dp[j]) %= 998244353;
        (next[j + A[i]] += dp[j]) %= 998244353;
      }
    swap(next, dp);
    (ans += dp[S]) %= 998244353;
  }
  cout << ans << endl;
}
