#include <bits/stdc++.h>
using namespace std;
bool** dp;
vector<pair<int, int>> vv;
void display(const vector<int>& v) {
  int mx = 0, mn = INT_MAX;
  for (int i = 0; i < v.size(); ++i) {
    mx = max(mx, v[i]);
    mn = min(mn, v[i]);
  }
  vv.push_back(make_pair(mn, mx));
}
void SubRec(int arr[], 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;
    SubRec(arr, i - 1, sum, b);
  }
  if (sum >= arr[i] && dp[i - 1][sum - arr[i]]) {
    p.push_back(i);
    SubRec(arr, i - 1, sum - arr[i], p);
  }
}
void CntSub(int arr[], int n, int sum) {
  if (n == 0 || sum < 0) return;
  dp = new bool*[n];
  for (int i = 0; i < n; ++i) {
    dp[i] = new bool[sum + 1];
    dp[i][0] = true;
  }
  if (arr[0] <= sum) dp[0][arr[0]] = true;
  for (int i = 1; i < n; ++i)
    for (int j = 0; j < sum + 1; ++j)
      dp[i][j] =
          (arr[i] <= j) ? dp[i - 1][j] || dp[i - 1][j - arr[i]] : dp[i - 1][j];
  if (dp[n - 1][sum] == false) {
    vv.push_back({-1, -1});
    return;
  }
  vector<int> p;
  SubRec(arr, n - 1, sum, p);
}
int main() {
  int n, s;
  long long int ans = 0;
  cin >> n >> s;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  CntSub(a, n, s);
  for (int i = 0; i < vv.size(); i++) {
    if (vv[i].first == -1) {
      cout << "0";
      return 0;
    }
    ans += (vv[i].first + 1) * (n - vv[i].second);
    ans = ans % 998244353;
  }
  cout << ans;
  return 0;
}
