#include <bits/stdc++.h>
using namespace std;
long long n, s;
long long a[3030];
long long MOD = 998244353;
long long dp[3030][3030];
long long f(long long x, long long y) {
  long long &r = dp[x][y];
  if (r >= 0) return r;
  if (y == a[x]) {
    r = x + 1;
    if (x > 0) r += f(x - 1, y), r %= MOD;
    return r;
  }
  if (x == 0) {
    return r = 0;
  }
  r = (f(x - 1, y) + f(x - 1, y - a[x])) % MOD;
  return r;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  for (int i = 0, ggdem = n; i < ggdem; ++i) cin >> a[i];
  memset((dp), (-1), sizeof(dp));
  long long res = 0;
  for (int i = 0, ggdem = n; i < ggdem; ++i) res += f(i, s), res %= MOD;
  cout << res;
  return 0;
}
