#include <bits/stdc++.h>
using namespace std;
struct S {
  int i;
  int j;
  int s;
};
static int64_t kRem = 998244353;
unordered_map<int64_t, int64_t> memo;
int64_t f(int i, int j, int s, vector<int>& as) {
  int64_t idx = i * 3001LL * 3001LL + j * 3001LL + s;
  auto it = memo.find(idx);
  if (it != memo.end()) {
    return it->second;
  }
  if (i == j) {
    if (s != 0) {
      if (as[i] == s)
        return 1;
      else
        return 0;
    }
    return 1;
  }
  int64_t ans = f(i + 1, j, s, as);
  if (as[i] <= s) {
    ans += f(i + 1, j, s - as[i], as);
    ans %= kRem;
  }
  memo[idx] = ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(20);
  int n, s;
  cin >> n >> s;
  vector<int> as(n);
  for (auto& a : as) cin >> a;
  int64_t ans = 0;
  for (int i = (int)(0); i < (int)(n); i++) {
    for (int j = (int)(i); j < (int)(n); j++) {
      ans += f(i, j, s, as);
      ans %= kRem;
    }
  }
  cout << ans << endl;
  return 0;
}
