#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N, S;
  cin >> N >> S;
  vector<long long> A(N);
  for (long long i = (long long)(0); i < (long long)(N); i++) cin >> A[i];
  long long ans = 0;
  for (long long i = (long long)(0); i < (long long)(N - 1); i++) {
    set<long long> s;
    s.insert(0);
    for (long long j = (long long)(i + 1); j < (long long)(N); j++) {
      long long X = A[i] + A[j];
      if (i + 1 == j) {
        if (X == S) ans += (i + 1) * (N - j) % 998244353;
      } else if (S >= X && s.count(S - X))
        ans += (i + 1) * (N - j) % 998244353;
      ans %= 998244353;
      set<long long> T;
      for (auto p : s) {
        T.insert(p);
        T.insert(p + A[j]);
      }
      s.swap(T);
    }
  }
  for (long long i = (long long)(0); i < (long long)(N); i++) {
    if (A[i] == S) {
      ans += (i + 1) * (N - i) % 998244353;
      ans %= 998244353;
    }
  }
  cout << ans << endl;
}
