#include <bits/stdc++.h>
using namespace std;
int f(int L, int R, vector<int> &A, int S) {
  int ans;
  if (L == R) {
    if (A.at(L - 1) == S) {
      ans = 1;
    } else {
      ans = 0;
    }
  } else if (S <= 0) {
    ans = 0;
  } else {
    if (A.at(R - 1) == S) {
      ans = f(L, R - 1, A, S) + f(L, R - 1, A, S - A.at(R - 1)) + 1;
    } else {
      ans = f(L, R - 1, A, S) + f(L, R - 1, A, S - A.at(R - 1));
    }
  }
  return ans;
}
int main() {
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int64_t ans = 0LL;
  for (int L = 1; L <= N; L++) {
    for (int R = L; R <= N; R++) {
      ans += f(L, R, A, S);
      if (ans >= 998244353) {
        ans %= 998244353;
      }
    }
  }
  cout << ans << endl;
}
