#include <bits/stdc++.h>
using namespace std;
int n, s;
int a[3005];
long long dp[3005][3005];
long long run(int idx, int now) {
  if (now == s) {
    return n - idx + 1;
  }
  if (idx == n) {
    return 0;
  }
  if (dp[idx][now] != -1) return dp[idx][now];
  long long ans = 0;
  ans += run(idx + 1, now);
  ans %= 998244353;
  int age = idx + 1;
  if (now + a[idx] <= s && now == 0)
    ans += (age * run(idx + 1, now + a[idx])) % 998244353;
  else
    ans += (run(idx + 1, now + a[idx])) % 998244353;
  ans %= 998244353;
  return dp[idx][now] = ans;
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << run(0, 0);
}
