#include <bits/stdc++.h>
using namespace std;
long long exp(long long taban, long long us) {
  long long carpan = taban % 1000000007;
  long long temp = us;
  long long res = 1;
  while (temp) {
    if (temp % 2) res = (res * carpan) % 1000000007;
    temp /= 2;
    carpan = (carpan * carpan) % 1000000007;
  }
  return res;
}
long long ebob(long long a, long long b) {
  if (!a) return b;
  return ebob(b % a, a);
}
long long ekok(long long a, long long b) { return (a * b) / ebob(a, b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, s;
  cin >> n >> s;
  vector<int> vec(n);
  vector<vector<int>> begins(s + 1);
  begins[0].push_back(0);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
    if (vec[i] == s) {
      ans = (ans + (i + 1) * (n - i)) % 998244353;
    } else if (vec[i] < s)
      for (auto x : begins[s - vec[i]]) {
        ans = (ans + (n - i) * (x + 1)) % 998244353;
      }
    for (int j = s; j >= 1; j--) {
      if (j + vec[i] <= s) {
        for (int k = 0; k < begins[j].size(); k++) {
          begins[j + vec[i]].push_back(begins[j][k]);
        }
      }
    }
    if (vec[i] <= s) begins[vec[i]].push_back(i);
  }
  cout << ans << endl;
}
