#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tll = tuple<ll, ll, ll>;
int main() {
  ll N, S;
  cin >> N >> S;
  vll A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll ans = 0, mod = 998244353;
  vvll dp(N + 1, vll(S + 1, 0));
  for (int l = 0; l < N; l++) {
    for (int r = l; r < N; r++) {
      dp.assign(N + 1, vll(S + 1, 0));
      dp[l][0] = 1;
      for (int i = l; i < r + 1; i++) {
        for (int j = 0; j <= S; j++) {
          dp[i + 1][j] += dp[i][j];
          if (j >= A[i]) {
            dp[i + 1][j] += dp[i][j - A[i]];
          }
        }
      }
      ans += dp[r + 1][S] % mod;
    }
  }
  cout << ans % mod << endl;
}
