#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int mod = 998244353;
const int N = 1e5 + 10;
const int inf = 1e9;
long long f[3030][3030][3];
int n, s, a[3030];
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  f[0][0][0] = 1;
  for (int i = 0; i <= n - 1; i++)
    for (int j = 0; j <= s; j++) {
      (f[i + 1][j][0] += f[i][j][0]) %= mod;
      (f[i + 1][j][1] += f[i][j][0] + f[i][j][1]) %= mod;
      (f[i + 1][j][2] += f[i][j][0] + f[i][j][1] + f[i][j][2]) %= mod;
      if (j + a[i] <= s) {
        (f[i + 1][j + a[i + 1]][1] += f[i][j][0] + f[i][j][1]) %= mod;
        (f[i + 1][j + a[i + 1]][2] += f[i][j][0] + f[i][j][1]) %= mod;
      }
    }
  cout << f[n][s][2] << endl;
  return 0;
}
