#include <bits/stdc++.h>
using namespace std;
int a[3010];
map<long long, long long> s[3010];
int main() {
  long long n, sm;
  while (cin >> n >> sm) {
    long long ans = 0, mod = 998244353;
    for (long long i = 0; i < n; ++i) {
      scanf("%d", a + i);
    }
    for (long long i = 0; i < n; ++i) {
      for (int j = sm; j > a[i]; --j) {
        for (auto it : s[j - a[i]]) {
          s[j][it.first] += it.second;
          if (j == sm) {
            long long tmp = (it.first + 1) * (n - i);
            tmp %= mod;
            tmp *= it.second;
            tmp %= mod;
            ans += tmp;
            ans %= mod;
          }
        }
      }
      s[a[i]][i]++;
      if (a[i] == sm) {
        ans += (n - i) * (i + 1);
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
