#include <bits/stdc++.h>
using namespace std;
constexpr long long int mod = 998244353;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int res = 0;
  for (int i = 0; i < n; i++) {
    int dp[6030] = {};
    dp[0] = 1;
    if (a[i] == s) {
      (res += (i + 1) * (n - i)) %= mod;
    } else {
      int ss = s - a[i];
      for (int j = i + 1; j < n; j++) {
        if (ss - a[j] >= 0) {
          (res += (i + 1) * (n - j) * dp[ss - a[j]]) %= mod;
        }
        for (int k = 3000; k >= 0; k--) {
          dp[a[j] + k] += dp[k];
        }
      }
    }
  }
  cout << res << endl;
}
