#include <bits/stdc++.h>
using namespace std;
template <typename T>
void showarr(T a, int n) {
  for (int i = 0, i_len = (n - 1); i < i_len; ++i) {
    cout << a[i] << " ";
  }
  if (n > 0) cout << a[n - 1] << endl;
}
long long dp[3000][3000];
long long sumlist[3000 + 1];
long long getsum(int l, int r) { return sumlist[r + 1] - sumlist[l]; }
int main() {
  int n, v, s;
  int arr[3000];
  cin >> n >> s;
  for (int i = 0, i_len = (n); i < i_len; ++i) {
    scanf("%d", &v);
    arr[i] = v;
  }
  sumlist[0] = 0;
  long long ans = 0;
  for (int i = 0, i_len = (n); i < i_len; ++i) {
    sumlist[i + 1] = sumlist[i] + arr[i];
    if (arr[i] == s) {
      dp[i][i] = 1;
      ans++;
    } else {
      dp[i][i] = 0;
    }
  }
  for (int i = 1; i < n; i++) {
    for (int j = i; j < n; j++) {
      dp[j - i][j] = dp[j - i + 1][j] + dp[j - i][j - 1];
      if (getsum(j - i, j) == s) {
        dp[j - i][j] += 1;
      }
      ans += dp[j - i][j];
    }
  }
  printf("%d\n", ans % 998244353ll);
  return 0;
}
