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