#include <bits/stdc++.h>
using namespace std;
const int NMAX = 3e3 + 5;
const int MOD = 998244353;
int N, S, A[NMAX];
int dp[NMAX];
long long ans = 0;
int cnt[NMAX];
static inline void Read() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N >> S;
  for (int i = 1; i <= N; ++i) cin >> A[i];
  return;
}
static inline void Solve() {
  for (int Left = 1; Left <= N; ++Left) {
    for (int s = 0; s <= S; ++s) dp[s] = 0;
    dp[0] = 1;
    for (int Right = Left; Right <= N; ++Right) {
      for (int s = S - A[Right]; s >= 0; --s)
        if (dp[s]) dp[s + A[Right]] = (dp[s + A[Right]] + dp[s]) % MOD;
      ans = (ans + dp[S]) % MOD;
    }
  }
  cout << ans << '\n';
  return;
}
int main() {
  Read();
  Solve();
  return 0;
}
