#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 998244353;
void add(int64_t& a, int64_t b) { a = (a + b) % MOD; }
void mul(int64_t& a, int64_t b) { a = a * b % MOD; }
int main() {
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  int64_t ans = 0;
  for (int L = 0; L < N; L++) {
    vector<int64_t> dp(3001);
    dp[A[L]] = 1;
    if (A[L] == S) add(ans, (L + 1) * (N - L));
    for (int i = L + 1; i < N; i++) {
      if (S >= A[i]) {
        int64_t res = dp[S - A[i]] * (L + 1) * (N - i) % MOD;
        add(ans, res);
      }
      for (int j = 3000; j >= A[i]; j--) add(dp[j], dp[j - A[i]]);
    }
  }
  cout << ans << endl;
  return 0;
}
