#include <bits/stdc++.h>
using namespace std;
long long int dp[3005][3005];
long long int S, N;
long long int A[3005];
const long long int MOD = 998244353;
void clear() {
  for (long long int i = 0; i < 3005; i++) {
    for (long long int j = 0; j < 3005; j++) {
      dp[i][j] = 0;
    }
  }
}
inline long long int mul(long long int x, long long int y, long long int mod) {
  x %= mod;
  y %= mod;
  long long int res = ((x * y) % mod + mod) % mod;
  return res;
}
long long int power(long long int x, long long int n, long long int mod) {
  long long int res = 1;
  x %= mod;
  while (n) {
    if (n & 1) {
      res = ((res * x) % mod + mod) % mod;
    }
    x = ((x * x) % mod + mod) % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> N >> S;
  clear();
  for (long long int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  dp[0][0] = 1;
  for (long long int i = 1; i <= N; i++) dp[0][i] = 1;
  long long int ans = 0;
  for (long long int i = 1; i <= S; i++) {
    for (long long int j = 1; j <= N; j++) {
      if (i > A[j]) {
        dp[i][j] = (dp[i][j - 1] + dp[i - A[j]][j - 1]) % MOD;
      } else if (i == A[j]) {
        dp[i][j] = (j + dp[i][j - 1]) % MOD;
      } else {
        dp[i][j] = dp[i][j - 1] % MOD;
      }
    }
  }
  for (long long int i = 1; i <= N; i++) {
    ans = (ans + dp[S][i]) % MOD;
  }
  cout << dp[S][N] << endl;
}
