#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353LL;
int n, s;
int v[3000 + 9];
long long ap[3000 + 9];
void modd(long long &a) {
  if (a >= MOD) a -= MOD;
  if (a < 0) a += MOD;
}
void modd(int &a) {
  if (a >= MOD) a -= MOD;
  if (a < 0) a += MOD;
}
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  long long rez = 0;
  for (int i = 1; i <= n; i++) {
    if (v[i] != s)
      rez += 1LL * (n - i + 1) * ap[s - v[i]] % MOD;
    else if (v[i] == s)
      rez += 1LL * (n - i + 1) * i % MOD;
    modd(rez);
    for (int j = s; j > v[i]; j--) {
      ap[j] += ap[j - v[i]];
      modd(ap[j]);
    }
    ap[v[i]] += i;
    modd(ap[v[i]]);
  }
  cout << rez << "\n";
  return 0;
}
