#include <bits/stdc++.h>
using namespace std;
long long N, S;
long long A[3005];
int main() {
  cin >> N >> S;
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  map<pair<long long, long long>, long long> memo;
  map<pair<long long, long long>, long long> nextmemo;
  for (long long i = 0; i < N; i++) {
    for (auto item : memo) {
      long long left = item.first.first;
      long long sumi = item.first.second;
      long long num = item.second;
      nextmemo[item.first] += num;
      if (sumi + A[i] == S) {
        ans += (left + 1) * (N - i) * num;
        ans %= 998244353;
      } else if (sumi + A[i] < S) {
        nextmemo[make_pair(left, sumi + A[i])] += num;
      }
    }
    if (A[i] == S) {
      ans += (i + 1) * (N - i);
      ans %= 998244353;
    } else if (A[i] < S) {
      nextmemo[make_pair(i, A[i])] += 1;
    }
    swap(memo, nextmemo);
    nextmemo.clear();
  }
  cout << ans << endl;
}
