#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
template <typename T>
bool chmax(T& source, const T& compare_to) {
  if (source < compare_to) {
    source = compare_to;
    return true;
  }
  return false;
}
int modpow(long long base, int n) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * base % mod;
    base = base * base % mod;
    n >>= 1;
  }
  return ret;
}
class Solution {
 private:
 public:
  int solve(int n, int k, vector<int>& arr) {
    vector<vector<vector<int>>> dp(n + 1,
                                   vector<vector<int>>(k + 1, vector<int>(3)));
    dp[0][0][0] = 1;
    for (int i = 0; i < n; ++i) {
      for (int s = 0; s <= k; ++s) {
        (dp[i + 1][s][0] += dp[i][s][0]) %= mod;
        (dp[i + 1][s][1] += dp[i][s][0] + dp[i][s][1]) %= mod;
        (dp[i + 1][s][2] += dp[i][s][0] + dp[i][s][1] + dp[i][s][2]) %= mod;
        if (s + arr[i] <= k) {
          (dp[i + 1][s + arr[i]][1] += dp[i][s][0] + dp[i][s][1]) %= mod;
          (dp[i + 1][s + arr[i]][2] += dp[i][s][0] + dp[i][s][1]) %= mod;
        }
      }
    }
    return dp[n][k][2];
  }
};
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> arr(n);
  for (int i = 0; i < n; ++i) cin >> arr[i];
  Solution sol;
  auto ret = sol.solve(n, k, arr);
  cout << ret << endl;
}
