#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17;
const long long MOD = 998244353;
const long long MAX = 1000001;
long long max(long long a, long long b) {
  if (a > b) {
    return a;
  }
  return b;
}
long long min(long long a, long long b) {
  if (a > b) {
    return b;
  }
  return a;
}
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  if (a < b) {
    return gcd(b, a);
  }
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
struct edge {
  long long ind;
  long long fr;
  long long to;
  long long d;
};
int main() {
  long long N, S;
  cin >> N >> S;
  vector<long long> A(N + 1);
  for (long long i = 1; i <= N; i++) cin >> A[i];
  vector<vector<long long>> dp(N + 1, vector<long long>(S + 1, 0));
  for (long long i = 1; i <= N; i++) dp[i][0] = 1;
  for (long long i = 1; i <= N; i++)
    for (long long j = 1; j <= S; j++) {
      if (j < A[i]) {
        dp[i][j] = dp[i - 1][j];
      }
      if (j == A[i]) {
        dp[i][j] = dp[i - 1][j] + i;
      }
      if (j > A[i]) {
        dp[i][j] = dp[i - 1][j] + dp[i - 1][j - A[i]];
      }
      dp[i][j] %= MOD;
    }
  long long ans = 0;
  for (long long i = 1; i <= N; i++) {
    long long X = dp[i][S] - dp[i - 1][S];
    X *= (N - i + 1);
    ans += X;
    ans %= MOD;
    if (ans < 0) {
      ans += ans;
    }
  }
  cout << ans;
  system("PAUSE");
}
