#include <bits/stdc++.h>
int n, s;
long long pi[3333], pp[3333];
long long ssou(long long *pp, int l, int r) {
  long long sum = pp[s];
  if (l == r) return sum;
  long long pk[3333];
  for (int i = 0; i <= s; i++)
    if (i < pi[r])
      pk[i] = pp[i];
    else
      pk[i] = (pp[i] - pk[i - pi[r]] + 998244353) % 998244353;
  sum = (sum + ssou(pk, l, r - 1)) % 998244353;
  return sum;
}
long long sou(long long *pp, int l, int r) {
  long long sum = pp[s];
  if (l == r) return sum;
  long long pk[3333];
  for (int i = 0; i <= s; i++)
    if (i < pi[l])
      pk[i] = pp[i];
    else
      pk[i] = (pp[i] - pk[i - pi[l]] + 998244353) % 998244353;
  sum = (sum + sou(pk, l + 1, r)) % 998244353;
  for (int i = 0; i <= s; i++)
    if (i < pi[r])
      pk[i] = pp[i];
    else
      pk[i] = (pp[i] - pk[i - pi[r]] + 998244353) % 998244353;
  sum = (sum + ssou(pk, l, r - 1)) % 998244353;
  return sum;
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%lld", &pi[i]);
  pp[0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = s; j >= pi[i]; j--)
      pp[j] = (pp[j] + pp[j - pi[i]]) % 998244353;
  printf("%lld", sou(pp, 1, n));
  return 0;
}
