#include <bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
string Yes(bool b) {
  if (b) {
    return "Yes";
  } else {
    return "No";
  }
}
string YES(bool b) {
  if (b) {
    return "YES";
  } else {
    return "NO";
  }
}
int main() {
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (int(i) = 0; (i) < (N); (i)++) cin >> A[i];
  const int MOD = 998244353;
  vector<vector<int>> dp_L(N + 1, vector<int>(3001, 0));
  vector<vector<int>> dp_R(N + 1, vector<int>(3001, 0));
  const int MAX = 3000;
  dp_L[0][0] = 1;
  for (int i = 0; i < N; i++) {
    for (int s = MAX; s >= 0; s--) {
      if (s + A[i] > MAX) continue;
      dp_L[i + 1][s] = (dp_L[i + 1][s] + dp_L[i][s]) % MOD;
      dp_L[i + 1][s + A[i]] = (dp_L[i + 1][s + A[i]] + dp_L[i][s]) % MOD;
    }
  }
  dp_R[N][0] = 1;
  for (int i = N; i > 0; i--) {
    for (int s = MAX; s >= 0; s--) {
      if (s + A[i] > MAX) continue;
      dp_R[i - 1][s] = (dp_R[i - 1][s] + dp_R[i][s]) % MOD;
      dp_R[i - 1][s + A[i]] = (dp_R[i - 1][s + A[i]] + dp_R[i][s]) % MOD;
    }
  }
  i64 ans = 0;
  for (int l = 1; l < N; l++) {
    for (int r = l; r < N; r++) {
      i64 res = dp_L[N][S] - (dp_L[l - 1][S] + dp_R[r + 1][S]);
      if (res < 0) res += MOD;
      ans = (ans + res) % MOD;
    }
  }
  cout << ans << endl;
}
