#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int ans = 0, t, s;
bool dp[3001][3001];
void display(const vector<int>& v) {
  int add = 1LL * (t - v[0]) * (v.back() + 1) % MOD;
  ans = (ans + add) % MOD;
}
void path(int v[], int i, int sum, vector<int>& p) {
  if (i == 0 && sum != 0 && dp[0][sum]) {
    p.push_back(i);
    display(p);
    return;
  }
  if (i == 0 && sum == 0) {
    display(p);
    return;
  }
  if (dp[i - 1][sum]) {
    vector<int> b = p;
    path(v, i - 1, sum, b);
  }
  if (sum >= v[i] && dp[i - 1][sum - v[i]]) {
    p.push_back(i);
    path(v, i - 1, sum - v[i], p);
  }
}
void solve(int v[], int n, int sum) {
  if (n == 0 || sum < 0) return;
  for (int i = 0; i < n; ++i) {
    dp[i][0] = true;
  }
  if (v[0] <= sum) dp[0][v[0]] = true;
  for (int i = 1; i < n; ++i)
    for (int j = 0; j < sum + 1; ++j) {
      if (v[i] <= j)
        dp[i][j] = dp[i - 1][j] || dp[i - 1][j - v[i]];
      else
        dp[i][j] = dp[i - 1][j];
    }
  if (dp[n - 1][sum] == false) return;
  vector<int> p;
  path(v, n - 1, sum, p);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> t >> s;
  int v[3001];
  for (int i = 0; i < (int)t; i++) cin >> v[i];
  solve(v, t, s);
  cout << ans << '\n';
  return 0;
}
