#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
int n, s;
int a[3010], dp[3010][3010][3];
int f(int x) {
  if (x >= 998244353)
    return x - 998244353;
  else
    return x;
}
int main() {
  scanf("%d %d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dp[0][0][0] = 1;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= s; j++) {
      dp[i + 1][j][0] = f(dp[i + 1][j][0] + dp[i][j][0]);
      dp[i + 1][j][1] = f(dp[i + 1][j][1] + f(dp[i][j][0] + dp[i][j][1]));
      dp[i + 1][j][2] =
          f(dp[i + 1][j][2] + f(f(dp[i][j][0] + dp[i][j][1]) + dp[i][j][2]));
      if (j + a[i + 1] <= s) {
        dp[i + 1][j + a[i + 1]][1] =
            f(dp[i + 1][j + a[i + 1]][1] + f(dp[i][j][0] + dp[i][j][1]));
        dp[i + 1][j + a[i + 1]][2] =
            f(dp[i + 1][j + a[i + 1]][2] + dp[i][j][1]);
      }
    }
  printf("%d", dp[n][s][2]);
  return 0;
}
