#include <bits/stdc++.h>
using namespace std;
long long int fastMax(long long int x, long long int y) {
  return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y;
}
long long int fastMin(long long int x, long long int y) {
  return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x;
}
const long long int MAXN = 3005;
long long int n, S;
long long int a[MAXN];
long long int dp[MAXN][MAXN][2];
const long long int MOD = 998244353;
long long int rec(long long int idx, long long int sum, long long int flag) {
  if (idx == n + 1) return 0;
  long long int &ans = dp[idx][sum][flag];
  if (ans != -1) return ans;
  ans = 0;
  ans = (ans + rec(idx + 1, sum, flag));
  if (flag == 0) {
    long long int n_S = sum + a[idx];
    if (n_S < S) ans = (ans + (idx * rec(idx + 1, n_S, 1) % MOD) % MOD) % MOD;
    if (n_S == S) ans = (ans + (idx * (n - idx + 1)) % MOD) % MOD;
  } else {
    long long int n_S = sum + a[idx];
    if (n_S < S) ans = (ans + rec(idx + 1, n_S, flag) % MOD) % MOD;
    if (n_S == S) ans = (ans + (n - idx + 1) % MOD) % MOD;
  }
  return ans;
}
void solve() {
  cin >> n >> S;
  for (long long int i = (1); i <= (n); ++i) cin >> a[i];
  memset((dp), -1, sizeof((dp)));
  cout << rec(1, 0, 0) << '\n';
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t = 1;
  for (long long int i = (1); i <= (t); ++i) {
    solve();
  }
}
