#include <bits/stdc++.h>
using namespace std;
long long dp[3010][3010], A[3010];
int main() {
  long long N, S;
  cin >> N >> S;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  for (long long i = 0; i <= N; i++) {
    dp[i + 1][A[i]] += i + 1;
    dp[i + 1][0] += dp[i][0];
    dp[i + 1][A[i]] %= 998244353;
    dp[i + 1][0] %= 998244353;
    for (int j = 1; j < S; j++) {
      dp[i + 1][j + A[i]] += dp[i][j];
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][j + A[i]] %= 998244353;
      dp[i + 1][j] %= 998244353;
    }
    ans += dp[i][S] * (N - i + 1);
    ans %= 998244353;
  }
  cout << ans << endl;
}
