#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  int p = 998244353;
  vector<vector<int>> c(n + 1, vector<int>(s + 1, 0));
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= s; j++)
      c[i][j] =
          (c[i - 1][j] + (j >= a.at(i - 1) ? c[i - 1][j - a.at(i - 1)] : 0)) %
          p;
    c[i][0] = (c[i][0] + 1) % p;
    c[i][a.at(i - 1)] = (c[i][a.at(i - 1)] + 1) % p;
  }
  int x = 0;
  for (int i = 1; i <= n; i++) x = (x + c[i][s]) % p;
  cout << x << endl;
}
