#include <bits/stdc++.h>
using namespace std;
long long p = 998244353ll;
long long fun(vector<long long> &vec, vector<vector<vector<long long>>> &dp,
              bool selected, int index, long long sum) {
  int n = vec.size();
  if (sum < 0) return 0;
  if (sum == 0) {
    return index + 2;
  }
  if (index == 0) {
    if (vec[index] == sum)
      return 1;
    else
      return 0;
  }
  if (selected) {
    if (dp[index][sum][1] != -1) {
      return dp[index][sum][1];
    }
    dp[index][sum][1] = fun(vec, dp, true, index - 1, sum) +
                        fun(vec, dp, true, index - 1, sum - vec[index]);
    dp[index][sum][1] %= p;
    return dp[index][sum][1];
  } else {
    if (dp[index][sum][0] != -1) {
      return dp[index][sum][0];
    }
    dp[index][sum][0] =
        fun(vec, dp, false, index - 1, sum) +
        (fun(vec, dp, true, index - 1, sum - vec[index]) * (n - index)) % p;
    dp[index][sum][0] %= p;
    return dp[index][sum][0];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, s;
  cin >> n >> s;
  vector<long long> vec(n);
  for (int i = 0; i < n; ++i) {
    cin >> vec[i];
  }
  vector<vector<vector<long long>>> dp(
      n, vector<vector<long long>>(3000, vector<long long>(2, -1)));
  long long ans = fun(vec, dp, false, n - 1, s);
  cout << ans << "\n";
}
