#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 998244353;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  ll N, S;
  cin >> N >> S;
  vector<ll> A(N);
  for (ll i = 0; i < (N); ++i) cin >> A[i];
  vector<vector<ll>> dp(3000, vector<ll>(3000));
  for (ll i = 0; i < (3000); ++i)
    for (ll j = 0; j < (3000); ++j) dp[i][j] = 0;
  dp[0][0] = 1;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j <= S; ++j) {
      (dp[i + 1][j] += dp[i][j]) %= MOD;
      if (j >= A[i]) (dp[i + 1][j] += dp[i][j - A[i]]) %= MOD;
    }
  }
  ll ans = 0;
  for (ll a = 0; a < (N); ++a)
    for (ll b = 0; b < (N); ++b) {
      if (a == b) {
        ans += A[a] == S;
        ans %= MOD;
      }
      if (a < b) {
        ans += dp[b + 1][S] - dp[a + 1][S];
        ans %= MOD;
      }
    }
  cout << (ans) << '\n';
  return 0;
}
