#include <bits/stdc++.h>
const int MOD = 998244353;
int dp[3005];
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  int n, s;
  std::cin >> n >> s;
  std::vector<int> A(n + 1);
  for (int i = 0; i < (n); ++i) std::cin >> A[i + 1];
  int ans = 0;
  dp[0] = 1;
  for (int i = (1); i < (n + 1); ++i) {
    for (int j = s; j > A[i]; --j) dp[j] = (dp[j] + dp[j - A[i]]);
    dp[A[i]] = (dp[A[i]] + i) % MOD;
    ans = (ans + dp[s]) % MOD;
  }
  std::cout << ans;
  return 0;
}
