#include <bits/stdc++.h>
using namespace std;
constexpr 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<int>> dp(s + 3030, vector<int>(3));
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    vector<vector<int>> next(s + 3030, vector<int>(3));
    for (int j = 0; j <= s; ++j) {
      next[j][0] += dp[j][0];
      next[j][1] += dp[j][1];
      next[j + a[i]][1] += dp[j][1];
      next[j][2] += dp[j][2];
      next[j][1] += dp[j][0];
      next[j + a[i]][1] += dp[j][0];
      next[j][2] += dp[j][1];
      next[j + a[i]][2] += dp[j][0] + dp[j][1];
      next[j][0] %= MOD;
      next[j][1] %= MOD;
      next[j][2] %= MOD;
      next[j + a[i]][1] %= MOD;
      next[j + a[i]][2] %= MOD;
    }
    dp = next;
  }
  cout << dp[s][2];
  return 0;
}
