#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  const long long mod = 998244353;
  long long n, s;
  cin >> n >> s;
  vector<long long> a(n);
  for (long long i = 0, i_len = (n); i < i_len; i++) cin >> a[i];
  vector<long long> dp(s + 1, 0);
  long long ans = 0;
  for (long long i = 0, i_len = (n); i < i_len; i++) {
    dp[0] += 1;
    for (long long j = (s + 1) - 1; j >= (a[i]); j--) {
      if (j == s) ans = (ans + dp[j - a[i]] * (n - 1 - i)) % mod;
      dp[j] += dp[j - a[i]];
    }
  }
  ans = (ans + dp[s]) % mod;
  cout << ans << "\n";
  return 0;
}
