#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
void err(istream_iterator<string> it) { cout << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " ";
  err(++it, args...);
}
int ways[3005][3005];
int a[3005];
int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int ans = 0, mod = 998244353;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= s; j++) ways[i][j] = ways[i - 1][j];
    if (a[i] > s) continue;
    ways[i][0] = i;
    int val = ways[i][s - a[i]] * (n - (i - 1));
    ans = (ans + val) % mod;
    ways[i][a[i]] += i;
    for (int j = 1; j <= s - a[i]; j++) {
      ways[i][j + a[i]] += ways[i - 1][j];
    }
  }
  cout << ans;
}
