#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, s, ans = 0, mod = 998244353;
  cin >> n >> s;
  vector<long long> A(n), f(3010, 0);
  for (long long i = 0; i < n; ++i) cin >> A[i];
  for (long long a : A) {
    f[0] += 1;
    vector<long long> ff;
    for (long long i = 0; i < s - a + 1; ++i) ff.emplace_back(f[i]);
    for (long long i = 0; i < s - a + 1; ++i) f[i + a] += ff[i];
    for (long long i = 0; i < s + 1; ++i) f[i] %= mod;
    ans += f[s];
  }
  cout << (ans) << endl;
  return 0;
}
