#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll atcoder_mod = 1e9 + 7;
template <typename T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}
template <typename T = int, typename C = vector<T>>
C vecin(int N) {
  C x(N);
  for (int i = 0; i < (N); ++i) {
    x[i] = in<T>();
  }
  return move(x);
}
void vout() { cout << endl; }
template <typename Head, typename... Tail>
void vout(Head&& h, Tail&&... t) {
  cout << ' ' << h;
  vout(forward<Tail>(t)...);
}
void out() { cout << endl; }
template <typename Head, typename... Tail>
void out(Head&& h, Tail&&... t) {
  cout << h;
  vout(forward<Tail>(t)...);
}
const ll MOD = 998244353;
void rec(const vector<vector<long long>>& dp, const vector<int>& a, int i,
         int j, deque<int>& keiro, vector<deque<int>>& ans) {
  if (i == 0) {
    if (j == 0) {
      ans.push_back(keiro);
    }
    return;
  }
  if (dp[i - 1][j]) {
    rec(dp, a, i - 1, j, keiro, ans);
  }
  if (j - a[i - 1] >= 0 && dp[i - 1][j - a[i - 1]]) {
    keiro.push_front(i - 1);
    rec(dp, a, i - 1, j - a[i - 1], keiro, ans);
    keiro.pop_front();
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N = in(), S = in();
  auto A = vecin(N);
  vector<vector<ll>> dp(N + 1, vector<ll>(S + 1, 0));
  dp[0][0] = 1;
  vector<int> H;
  for (int i = 0; i < (N); ++i) {
    for (int j = 0; j < (S + 1); ++j) {
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][j] %= MOD;
      if (j >= A[i]) {
        if (dp[i][j - A[i]] > 0) H.push_back(i);
        dp[i + 1][j] += dp[i][j - A[i]];
        dp[i + 1][j] %= MOD;
      }
    }
  }
  deque<int> keiro;
  vector<deque<int>> ans;
  rec(dp, A, N, S, keiro, ans);
  ll P = 0;
  for (auto& x : ans) {
    ll f = x.front() + 1LL;
    ll b = N - x.back();
    ll k = (f * b) % MOD;
    P += k;
    P %= MOD;
  }
  out(P);
  return 0;
}
