#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; }
long long N, S, A[3123];
long long memo[3123][3123];
int main() {
  cin >> N >> S;
  for (long long i = 0; i < (N); ++i) cin >> A[i];
  for (long long i = 0; i < (N); ++i) {
    if (!i) {
      memo[i][0]++;
      memo[i][A[i]]++;
    } else {
      for (long long j = 0; j < (S + 1); ++j) {
        if (!j) memo[i][j] = 1;
        memo[i][j] += memo[i - 1][j];
        memo[i][j] %= 998244353;
        if (j - A[i] >= 0) memo[i][j] += memo[i - 1][j - A[i]];
        memo[i][j] %= 998244353;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < (N); ++i) {
    ans += memo[i][S] * (N - i);
    ans %= 998244353;
  }
  cout << ans << endl;
  return 0;
}
