#include <bits/stdc++.h>
using namespace std;
int a[3005];
int dp[3005][3005];
int sum[3005];
constexpr auto mod = 998244353;
int main() {
  int n, s, ans = 0;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
    if (a[i] == s) {
      dp[i][i] = 1;
    }
  }
  for (int i = 2; i <= n; i++)
    for (int j = i - 1; j > 0; j--) {
      if (sum[i] - sum[j - 1] < s) continue;
      if (sum[i] - sum[j - 1] == s) {
        dp[i][j] += 1;
        continue;
      }
      for (int k = j; k < i; k++) {
        if (sum[i] - sum[k] == s) dp[i][j] += 1;
        if (sum[k] - sum[j - 1] == s) dp[i][j] += 1;
      }
      dp[i][j] %= mod;
    }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      ans += dp[i][j];
      ans %= mod;
    }
  }
  cout << ans;
  return 0;
}
