#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long s;
  map<pair<long long, long long>, long long> list[2];
  scanf("%d %lld", &n, &s);
  vector<long long> arr(3001);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
  }
  long long sol = 0;
  for (int i = 0; i < n; i++) {
    list[i % 2] = list[!(i % 2)];
    if (arr[i] == s) {
      sol = (sol + (long long)(i + 1) * (long long)(n - i) % 998244353) %
            998244353;
    } else if (arr[i] < s) {
      list[i % 2][{arr[i], i}] = 1;
      for (map<pair<long long, long long>, long long>::iterator it =
               list[!(i % 2)].begin();
           it != list[!(i % 2)].end(); it++) {
        if (it->first.first + arr[i] == s) {
          sol = (sol + (it->first.second + 1) * (long long)(n - i) % 998244353 *
                           it->second % 998244353) %
                998244353;
        } else if (it->first.first + arr[i] < s) {
          map<pair<long long, long long>, long long>::iterator ret;
          ret = list[i % 2].find({it->first.first + arr[i], it->first.second});
          if (ret == list[i % 2].end()) {
            list[i % 2][{it->first.first + arr[i], it->first.second}] =
                it->second;
          } else {
            ret->second += it->second;
          }
        }
      }
    }
  }
  printf("%lld\n", sol);
  return 0;
}
