#include <bits/stdc++.h>
using namespace std;
template <class T = int>
using V = vector<T>;
template <class T = int>
using VV = V<V<T> >;
template <class T = int>
void print(vector<T> v) {
  for (auto a : v) cout << a << " ";
  cout << endl;
}
long long n, s, a[3010], ans = 0;
long long dp[3001] = {}, dp2[3001] = {};
long long mod = 998244353;
int main(void) {
  cin >> n >> s;
  for (long long i = 0; i < ((long long)(n)); i++) cin >> a[i];
  for (long long i = 0; i < ((long long)(n)); i++) {
    if (s < a[i]) continue;
    if (s == a[i]) {
      ans += (i + 1) * (n - i);
      ans %= mod;
      continue;
    }
    int to = s - a[i];
    for (long long k = 0; k < ((long long)(to)); k++) {
      dp[k] = 0;
      dp2[k] = 0;
    }
    dp[0] = 1;
    dp2[0] = 1;
    for (long long j = ((long long)(i + 1)); j <= ((long long)(n - 1)); j++) {
      for (long long k = 0; k < ((long long)(to)); k++) {
        if (k + a[j] > to) break;
        if (k + a[j] == to) {
          ans += (i + 1) * (n - j);
          ans %= mod;
          break;
        }
        dp2[k + a[j]] += dp[k];
        dp2[k + a[j]] %= mod;
      }
      for (long long k = 0; k < ((long long)(to)); k++) dp[k] = dp2[k];
    }
  }
  cout << ans << endl;
  return 0;
}
