#include <bits/stdc++.h>
using namespace std;
const int N = 3000;
const long long md = 998244353;
const int inf = 123456789;
int n, s;
int a[N];
long long dp[N][N], dp2[N][N];
long long first, last;
long long cnt(int idx, int cur) {
  if (cur == 0) return 1;
  if (cur < 0 || idx == n) return 0;
  if (dp2[idx][cur] != -1) {
    return dp2[idx][cur];
  }
  long long res1, res2;
  res1 = cnt(idx + 1, cur - a[idx]);
  res2 = cnt(idx + 1, cur);
  return dp2[idx][cur] = res1 + res2;
}
long long f(int idx, int cur) {
  if (cur == 0) return idx - 1;
  if (cur < 0 || idx == n) return 0;
  if (dp[idx][cur] != -1) {
    return dp[idx][cur];
  }
  long long res1, res2;
  res1 = f(idx + 1, cur - a[idx]);
  res2 = f(idx + 1, cur);
  return dp[idx][cur] = res1 + res2;
}
int main() {
  scanf("%d %d", &n, &s);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  long long ans = 0;
  memset(dp, -1, sizeof dp);
  memset(dp2, -1, sizeof dp2);
  for (int i = 0; i < n; i++) {
    long long k = cnt(i + 1, s - a[i]);
    long long sum = f(i + 1, s - a[i]);
    ans = (ans + 1LL * (k * (long long)n * (long long)(i + 1)) -
           1LL * sum * (long long)(i + 1) + md) %
          md;
  }
  printf("%lld\n", ans);
  return 0;
}
