#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0;
  long long mod = 998244353;
  long long N, S;
  cin >> N >> S;
  vector<long long> coefficient(S + 1, 0);
  for (long long i = long long(0); i < long long(N); ++i) {
    long long a;
    cin >> a;
    vector<long long> t = coefficient;
    for (long long j = long long(a); j < long long(S + 1); ++j) {
      (t[j] += coefficient[j - a]) %= mod;
    }
    t[a]++;
    t[0]++;
    coefficient = t;
    (ans += coefficient[S]) %= mod;
  }
  cout << ans << endl;
}
