#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MOD = 1e9 + 7;
const double pi = acos(-1);
int main() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  vector<pair<int, int>> sum;
  for (long long i = 0; i < (n); i++) cin >> a[i];
  for (long long l = 0; l < (n); l++) {
    for (int k = l; k < n; k++) {
      bool dp[3010][3010] = {};
      dp[0][0] = true;
      int MAX = 0, MIN = 3010;
      for (int i = l; i <= k; ++i) {
        for (int j = 0; j <= s; ++j) {
          dp[i + 1][j] |= dp[i][j];
          if (j >= a[i]) {
            dp[i + 1][j] |= dp[i][j - a[i]];
            if (i < MIN) MIN = i;
            if (i > MAX) MAX = i;
          }
        }
      }
      if (dp[k + 1][s]) sum.push_back(make_pair(MIN, MAX));
    }
  }
  long long ans = 0;
  for (long long i = 0; i < (n); i++) {
    for (int j = i; j < n; j++) {
      for (long long k = 0; k < (sum.size()); k++) {
        if (i <= sum[k].first && j <= sum[k].second) {
          ans++;
          ans %= 998244353;
        }
      }
    }
  }
  cout << ans << endl;
}
