#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, S;
  long long mod = 998244353;
  cin >> N >> S;
  vector<vector<long long>> dp(N, vector<long long>(S + 1, 0));
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  if (a[0] <= S) dp[0][a[0]]++;
  for (int i = 1; i < N; i++) {
    for (int j = 1; j < S + 1; j++) {
      (dp[i][j] += dp[i - 1][j]) %= mod;
      (dp[i][j] += dp[i - 1][j]) %= mod;
      if (a[i] <= S) (dp[i - 1][a[i]] += i + 1) %= mod;
      if (dp[i - 1][j] != 0 && j + a[i] <= S) {
        (dp[i][j + a[i]] += dp[i - 1][j]) %= mod;
      }
    }
  }
  cout << dp[N - 1][S] << endl;
  return 0;
}
