#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int main() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<vector<vector<int>>> dp(n, vector<vector<int>>(n, vector<int>(3001)));
  for (int i = 0; i < n; i++) {
    dp[i][i][a[i]] = 1;
  }
  for (int l = 0; l < n; l++)
    for (int r = l + 1; r < n; r++)
      for (int sum = 3000; sum >= 0; sum--) {
        dp[l][r][sum] = dp[l][r - 1][sum] + dp[r][r][sum];
        if (sum >= a[r]) dp[l][r][sum] += dp[l][r - 1][sum - a[r]];
        dp[l][r][sum] %= MOD;
      }
  long long res = 0;
  for (int l = 0; l < n; l++)
    for (int r = 0; r < n; r++) {
      res += dp[l][r][s];
      res %= MOD;
    }
  cout << res;
}
