#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m, p, k, S;
long long a[3005];
long long ans;
long long dp[3005];
void solve(int x) {
  for (int i = 1; i <= n; i++) dp[i] = 0;
  dp[0] = 1;
  for (int i = x + 1; i <= n; i++) {
    if (S >= a[x] + a[i] && dp[S - a[x] - a[i]])
      ans =
          (ans + 1LL * dp[S - a[x] - a[i]] * x % mod * (n - i + 1) % mod) % mod;
    for (int j = S; j >= a[i]; j--) dp[j] = (dp[j] + dp[j - a[i]]) % mod;
  }
}
int main() {
  int i, j, l, op, x, y;
  n = read(), S = read();
  for (i = 1; i <= n; i++) a[i] = read();
  for (i = 1; i <= n; i++) {
    solve(i);
    if (a[i] == S) ans = (ans + 1LL * i * (n - i + 1) % mod) % mod;
  }
  printf("%lld", ans);
  return 0;
}
