#include <bits/stdc++.h>
using namespace std;
int main() {
  long k, n, s, j, a, m = 998244353, d[3001] = {};
  cin >> n >> s;
  while (n--) {
    cin >> a;
    j = s + 1;
    while (j-- > a) {
      d[j] += d[j - a];
    }
    d[a]++;
    d[0]++;
    k += d[s];
  }
  cout << k % m;
}
