#include <bits/stdc++.h>
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
using namespace std;
const long long MOD = 998244353;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const int INF = 1e9 + 7;
int _;
int n, k;
long long ans;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> n >> k;
  vector<int> A(n);
  vector<vector<long long>> dp(n + 1, vector<long long>(k + 2));
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < n; i++) {
    dp[i + 1] = dp[i];
    (dp[i + 1][A[i]] += i + 1) %= MOD;
    for (int j = 0; j + A[i] <= k; ++j) {
      (dp[i + 1][j + A[i]] += dp[i][j]) %= MOD;
    }
    (ans += dp[i + 1][k]) %= MOD;
  }
  cout << ans;
  return 0;
}
