#include <bits/stdc++.h>
using namespace std;
const long long m = 998244353;
long long cnt[3005][3005], dp[3005][3005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, s;
  cin >> n >> s;
  cnt[0][0] = 1;
  vector<long long> v(n + 1);
  for (int i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    v[i] = a;
    for (int su = s; su >= 0; su--) {
      cnt[i][su] = cnt[i - 1][su];
      if (su >= a) cnt[i][su] = (cnt[i - 1][su - a] + cnt[i][su] + m) % m;
    }
  }
  long long an = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      dp[i][j] =
          ((dp[i][j] + dp[i][j - 1]) % m + (s >= v[j] ? cnt[i][s - v[j]] : 0)) %
          m;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      long long k = v[i];
      if (i != j) {
        k += v[j];
      }
      long long z = 0;
      if (j - i >= 2 && s >= k)
        z = (cnt[j - 1][s - k] - dp[i][j - 1] - cnt[i][s - k] + 2 * m) % m;
      else {
        if (k == s) z = 1;
      }
      an = (an + (z * ((i) * (n - j + 1) % m) % m)) % m;
    }
  }
  cout << an << endl;
  return 0;
}
