#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const int inf = 1e8;
const long long INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main() {
  int N, S;
  cin >> N >> S;
  int A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  long long dp[N + 1][S + 1];
  long long ans = 0;
  fill(dp[0], dp[N + 1], 0);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < S + 1; j++) dp[i + 1][j] = dp[i][j];
    for (int j = S; j >= A[i] + 1; j--) {
      dp[i + 1][j] += dp[i][j - A[i]];
      dp[i + 1][j] %= MOD;
    }
    if (A[i] <= S) {
      dp[i + 1][A[i]] += i + 1;
    }
    ans += (N - i) * (dp[i + 1][S] - dp[i][S]);
  }
  cout << ans << endl;
}
