#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int main() {
  int n, s;
  scanf("%d %d", &n, &s);
  int inp[n + 1];
  for (int i = 0; i < n; i++) scanf("%d", &inp[i + 1]);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int cnt[3001] = {0};
    for (int j = i; j <= n; j++) {
      int diff = s - inp[j];
      long long r = n - j + 1;
      if (0 < diff && diff < s) {
        ans = (ans + r * cnt[diff]) % mod;
      } else if (inp[j] == s) {
        ans = (ans + r * 1) % mod;
      }
      for (int k = s; k > 0; k--) {
        if (cnt[k] > 0 && k + inp[j] <= s) {
          cnt[k + inp[j]]++;
        }
      }
      if (inp[j] < s) cnt[inp[j]]++;
      printf("%d %d %lld\n", i, j, ans);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
