#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vvll>;
using P = pair<ll, ll>;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const ll MOD = 998244353;
const ll inf = 1e18;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  ll n, s;
  cin >> n >> s;
  vll a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll res = 0;
  vvvll dp(n + 1, vvll(3030, vll(3)));
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < s + 1; j++) {
      for (int k = 0; k < 3; k++) dp[i + 1][j][k] += dp[i][j][k];
      dp[i + 1][j + a[i]][1] += dp[i][j][0] * (i + 1);
      dp[i + 1][j + a[i]][1] += dp[i][j][1];
      dp[i + 1][j + a[i]][2] +=
          dp[i][j][0] * (i + 1) * (n - i) + dp[i][j][1] * (n - i);
      for (int k = 0; k < 3; k++) {
        dp[i + 1][j][k] %= MOD;
        dp[i + 1][j + a[i]][k] %= MOD;
      }
    }
  }
  cout << dp[n][s][2] << endl;
  return 0;
}
