#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using db = long double;
using ii = pair<ll, ll>;
const ll N = 1e5 + 5, LG = 19, MOD = 998244353;
const ll SQ = 320;
const long double EPS = 1e-7;
ll dp[3005][3005];
ll n, s, a[3005];
ll solve(ll idx, ll sum) {
  if (sum > s) return 0;
  if (sum == s) return n - idx + 1;
  if (idx == n) return 0;
  ll &ret = dp[idx][sum];
  if (~ret) return ret;
  return ret = (solve(idx + 1, sum) + solve(idx + 1, sum + a[idx])) % MOD;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (ll i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof dp);
  ll ans = 0;
  for (ll i = 0; i < n; i++)
    (ans += 1ll * solve(i + 1, a[i]) * (i + 1) % MOD) % MOD;
  cout << ans << '\n';
  return 0;
}
