#include <bits/stdc++.h>
using namespace std;
long long rint() {
  long long ret = 0, uu = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') uu = -1, c = getchar();
  while (isdigit(c)) ret = ret * 10 + (c - '0'), c = getchar();
  return ret * uu;
}
long long n, s, a[3010], ans = 0;
bool can[3010][3010];
void dfs(long long nm, long long lft, long long l) {
  if (lft == 0) {
    if (l != -1) {
      ans = (ans + ((l + 1) * (n - nm + 1)) % 998244353) % 998244353;
      return;
    }
  }
  if (nm == n) {
    return;
  }
  long long i;
  if (can[nm + 1][lft]) {
    dfs(nm + 1, lft, l);
  }
  if (lft >= a[nm]) {
    if (can[nm + 1][lft - a[nm]]) {
      if (l != -1) {
        dfs(nm + 1, lft - a[nm], l);
      } else {
        dfs(nm + 1, lft - a[nm], nm);
      }
    }
  }
  return;
}
int main() {
  long long i, j;
  n = rint();
  s = rint();
  for (i = 0; i < n; i++) {
    a[i] = rint();
  }
  can[n][0] = true;
  for (i = n - 1; i >= 0; i--) {
    for (j = 0; j <= s; j++) {
      if (a[i] + j < 3010) {
        can[i][a[i] + j] |= can[i + 1][j];
      }
      can[i][j] |= can[i + 1][j];
    }
  }
  dfs(0, s, -1);
  cout << ans << endl;
  return 0;
}
