#include <bits/stdc++.h>
using namespace std;
const long long N = 2e6 + 51, MOD = 1e9 + 7, mod = 998244353, INF = 2e18;
mt19937 Flash_new_51(51515);
using vi = vector<long long>;
using vp = vector<pair<long long, long long>>;
long long a[N];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, s;
  cin >> n >> s;
  long long ans = 0;
  for (long long i = 0; i < n; i++) cin >> a[i];
  vi dp(s + 1, 0);
  for (long long i = 0; i < n; i++) {
    long long x = a[i];
    vi tek(s + 1, 0);
    for (long long j = 0; j < s; j++) {
      if (j == 0) {
        tek[x] = i + 1;
      } else {
        if (i) {
          tek[j] += dp[j];
          if (j + x <= s) {
            tek[j + x] += dp[j];
            tek[j + x] %= mod;
          }
          tek[j] %= mod;
        }
      }
    }
    dp = tek;
    ans += dp[s] * (n - i);
    ans %= mod;
  }
  cout << ans;
}
