#include <bits/stdc++.h>
using namespace std;
int static fast = []() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  return 0;
}();
int main() {
  long long mod = 998244353;
  int n, s;
  cin >> n >> s;
  vector<int> arr(n, 0);
  for (int& val : arr) cin >> val;
  vector<long long> dp(s + 1, 0);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    vector<long long> new_dp = dp;
    for (int j = 1; j <= s; j++) {
      if (dp[j] > 0 && j + arr[i] <= s) {
        new_dp[j + arr[i]] += dp[j];
      }
    }
    if (arr[i] <= s) {
      new_dp[arr[i]] += i + 1;
    }
    dp = new_dp;
    ans += dp[s];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
