#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int n, s;
long long d[3030], a;
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    for (int j = s - x; j > 0; j--) d[j + x] = (d[j + x] + d[j]) % mod;
    d[x] = (d[x] + i) % mod;
    a = (a + d[s] * (n - i + 1)) % mod;
  }
  printf("%llld\n", a);
  return 0;
}
