#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using pii = pair<long long, long long>;
const bool debug = 0;
const long long mod = 998244353;
long long dp[3030];
long long ans = 0;
long long arr[3030];
long long n, s;
int32_t main() {
  cin >> n >> s;
  for (long long i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (long long i = 1; i <= n; i++) {
    memset(dp, 0, sizeof(dp));
    dp[arr[i]] = 1;
    if (dp[s] > 0) {
      ans += (dp[s] * (i) * (n + 1 - i)) % mod;
      dp[s] = 0;
    }
    for (long long j = i + 1; j <= n; j++) {
      for (long long k = 3000; k >= arr[j]; k--) {
        dp[k] += dp[k - arr[j]];
        dp[k] %= mod;
      }
      ans += (dp[s] * (i) * (n + 1 - j)) % mod;
      dp[s] = 0;
    }
  }
  cout << ans << '\n';
}
