#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return a % b ? gcd(b, a % b) : b; }
pair<int, int> vu[4] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const int max_v = 3e3 + 7;
const int INF = 1e7 + 7;
int arr[max_v];
bool can[max_v][max_v];
int n, s;
int dp[max_v][max_v];
vector<pair<int, int> > vi;
const int mod = 998244353;
int dnq(int l, int r) {
  int& ret = dp[l][r];
  if (ret != -1) return ret;
  if (l == r) {
    return ret = can[l][r];
  }
  int mid = (l + r) / 2;
  ret = (dnq(l, mid) + dnq(mid + 1, r)) % mod;
  for (auto x : vi) {
    if (x.first <= mid && x.second >= mid + 1) ++ret;
  }
  return ret % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  sort(arr, arr + n);
  int l, r, sum;
  l = r = sum = 0;
  sum = arr[0];
  while (l <= r && r < n) {
    if (sum < s) {
      sum += arr[++r];
    } else if (sum > s) {
      sum -= arr[l++];
    } else {
      sum -= arr[l];
      vi.push_back({l, r});
      can[l++][r] = true;
    }
  }
  memset(dp, -1, sizeof(dp));
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      ans += dnq(i, j);
      ans %= mod;
    }
  }
  cout << ans;
  return 0;
}
