#include <bits/stdc++.h>
using namespace std;
long long int N;
int S;
int A[3005];
long long int dp[3005][3005][3];
int main() {
  scanf("%d %d", &N, &S);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  for (int i = 0; i <= N; i++) {
    for (int k = 0; k <= S; k++) {
      for (int p = 0; p < 3; p++) {
        dp[i][k][p] = 0;
      }
    }
  }
  dp[0][0][0] = 1;
  for (long long int i = 0; i < N; i++) {
    for (int k = 0; k <= S; k++) {
      dp[i + 1][k][0] += dp[i][k][0];
      dp[i + 1][k][0] %= 998244353;
      if (k + A[i] <= S) {
        dp[i + 1][k + A[i]][1] += dp[i][k][0] * (i + 1);
        dp[i + 1][k + A[i]][1] %= 998244353;
        dp[i + 1][k + A[i]][2] += dp[i][k][0] * (i + 1) * (N - i);
        dp[i + 1][k + A[i]][2] %= 998244353;
      }
      dp[i + 1][k][1] += dp[i][k][1];
      dp[i + 1][k][1] %= 998244353;
      if (k + A[i] <= S) {
        dp[i + 1][k + A[i]][2] += dp[i][k][1] * (N - i);
        dp[i + 1][k + A[i]][2] %= 998244353;
      }
      dp[i + 1][k][2] += dp[i][k][2];
    }
  }
  printf("%lld\n", dp[N][S][2]);
  return 0;
}
