#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long kk = 0, f = 1;
  char cc = getchar();
  while (cc < '0' || cc > '9') {
    if (cc == '-') f = -1;
    cc = getchar();
  }
  while (cc >= '0' && cc <= '9') {
    kk = (kk << 1) + (kk << 3) + cc - '0';
    cc = getchar();
  }
  return kk * f;
}
const int mod = 998244353;
long long a[1000222], n, m, dp[1000222];
long long asd = 0;
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  for (int i = 1; i <= n; ++i) {
    dp[0]++;
    for (int j = m; j >= a[i]; --j) dp[j] = (dp[j] + dp[j - a[i]]) % mod;
    asd += dp[m];
  }
  printf("%lld\n", asd);
}
