#include <bits/stdc++.h>
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,sse")
using namespace std;
const long long MOD = 998244353;
long long n, s;
vector<long long> arr;
bool f(long long l, long long r, long long s) {
  if (s < 0) return false;
  if (s == 0) return true;
  if (l == r) {
    return arr[l] == s;
  }
  return f(l + 1, r, s - arr[l]) || f(l + 1, r, s);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  arr.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long dp[n][n];
  long long tot = 0;
  for (long long k = 1; k <= n; k++) {
    for (long long i = 0, j = k - 1; j < n; i++, j++) {
      if (k == 1) {
        dp[i][i] = (arr[i] == s) ? 1 : 0;
      } else if (k == 2) {
        dp[i][j] = dp[i][i] + dp[j][j] + ((arr[i] + arr[j] == s) ? 1 : 0);
      } else {
        dp[i][j] = dp[i][j - 1] + dp[i + 1][j] - dp[i + 1][j - 1] +
                   (f(i + 1, j - 1, s - arr[i] - arr[j]) ? 1 : 0);
      }
      dp[i][j] %= MOD;
      tot += dp[i][j];
      tot %= MOD;
    }
  }
  cout << tot << '\n';
  fflush(stdout);
  return 0;
}
