#include <bits/stdc++.h>
using namespace std;
const long long int N = 3005;
long long int n, s;
long long int a[N], dp[N][N], ndp[N][N];
long long int add(long long int x, long long int y, long long int m) {
  long long int res = ((x % m) + (y % m)) % m;
  return res;
}
long long int mul(long long int x, long long int y, long long int m) {
  long long int res = ((x % m) * (y % m)) % m;
  return res;
}
long long int sub(long long int x, long long int y, long long int m) {
  long long int res = ((x % m) - (y % m) + m) % m;
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  const long long int M = 998244353;
  cin >> n >> s;
  for (long long int i = 0; i < n; ++i) cin >> a[i];
  dp[0][a[0]] = (0 + 1);
  ndp[0][a[0]] = 1;
  long long int res = 0;
  if (a[0] == s) res = n;
  for (long long int i = 1; i < n; ++i) {
    dp[i][a[i]] = (i + 1);
    ndp[i][a[i]] = (i + 1);
    for (long long int j = 0; j < N; ++j) {
      ndp[i][j] += ndp[i - 1][j];
      if (j > a[i]) ndp[i][j] += ndp[i - 1][j - a[i]];
      if (j > a[i]) dp[i][j] = ndp[i - 1][j - a[i]];
    }
    res = add(res, mul((n - i), dp[i][s], M), M);
    res %= M;
  }
  cout << res << '\n';
  return 0;
}
