#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007, MOD2 = 998244353;
int main() {
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (int i = 0; i < (N); i++) {
    cin >> A.at(i);
  }
  vector<vector<ll>> dp(N, vector<ll>(S + 1));
  dp.at(0).at(0) = 2;
  if (A.at(0) <= S) {
    dp.at(0).at(A.at(0)) = 1;
  }
  for (int i = 0; i < (N - 1); i++) {
    dp.at(i + 1).at(0) = i + 3;
    for (int j = 1; j < S; j++) {
      dp.at(i + 1).at(j) += dp.at(i).at(j);
    }
    for (int j = 0; j + A.at(i + 1) < S + 1; j++) {
      dp.at(i + 1).at(j + A.at(i + 1)) += dp.at(i).at(j);
    }
  }
  ll ans = 0;
  for (int i = 0; i < (N); i++) {
    ll x = dp.at(i).at(S);
    x *= (N - i);
    x %= MOD2;
    ans += x;
    ans %= MOD2;
  }
  cout << ans << endl;
}
