#include <bits/stdc++.h>
using namespace std;
const long long int N = 1000001;
const long long int M = 1;
struct point {
  long long int x, y;
};
long long int fast_exp(long long int x, long long int n) {
  if (n == 0)
    return 1;
  else if (n & 1)
    return fast_exp(x, n - 1) * x % 998244353;
  else {
    long long int tmp = fast_exp(x, n >> 1);
    return tmp * tmp % 998244353;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int _ = 1;
  while (_--) {
    long long int n, m = 0, ans = 0, x, y, k, s, c = 0;
    cin >> n >> s;
    long long int a[n];
    m = 3000 * n + 1;
    long long int **dp = new long long int *[2];
    dp[0] = new long long int[m]{};
    dp[1] = new long long int[m]{};
    for (int i = 0; i < n; i++) cin >> a[i];
    dp[c][0] = 1;
    dp[c][a[n - 1]] = 1;
    ans = dp[c][s];
    for (int i = n - 2; i > -1; i--) {
      c = !c;
      for (int j = 0; j < m; j++) dp[c][j] = 0;
      for (int j = 1; j < m - a[i]; j++) {
        dp[c][j + a[i]] += dp[!c][j];
        dp[c][j + a[i]] %= 998244353;
      }
      for (int j = 0; j < m; j++) dp[c][j] += dp[!c][j], dp[c][j] %= 998244353;
      dp[c][a[i]] += n - i;
      dp[c][a[i]] %= 998244353;
      ans += dp[c][s];
      ans %= 998244353;
    }
    cout << ans << "\n";
  }
  return 0;
}
