#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
long long N, S;
long long A[3000];
long long dp[3010];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> S;
  for (long long i = (0); i < (N); ++i) cin >> A[i];
  dp[0] = 1;
  for (long long i = (0); i < (N); ++i) {
    for (long long j = S; j - A[i] >= 1; --j) {
      long long k = (j == S ? N - i : 1);
      (dp[j] += dp[j - A[i]] * k % MOD) %= MOD;
    }
    (dp[A[i]] += i + 1) %= MOD;
  }
  cout << dp[S] << '\n';
}
