#include <bits/stdc++.h>
using namespace std;
int dbg = 0;
const int N = 2e5 + 1;
const int lg = 20;
const long long mod = 998244353;
void solve() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long x = 0;
  vector<long long> dpA(s + 1, 0);
  dpA[0] = 1;
  vector<long long> dpR(s + 1, 0);
  dpR[0] = 1;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] > s) continue;
    bool upd = 0;
    long long right = 0;
    for (int j = s + 1 - 1; j >= a[i] + 1; j--) {
      if (dpA[j - a[i]]) {
        if (j == s) {
          upd = 1;
          right = dpR[j - a[i]];
        }
        dpA[j] += dpA[j - a[i]];
        dpA[j] %= mod;
        dpR[j] += dpR[j - a[i]];
        dpR[j] %= mod;
      }
    }
    if (a[i] == s) {
      upd = 1;
      right = dpR[0];
    }
    dpA[a[i]]++;
    dpA[a[i]] %= mod;
    dpR[a[i]] += (n - i);
    dpR[a[i]] %= mod;
    if (upd) {
      long long left = i + 1;
      long long add = (left * right) % mod;
      x += add;
      x %= mod;
    }
  }
  cout << x << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
