#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int dp[4000];
int main() {
  int n, s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    dp[0] += 1;
    int a;
    cin >> a;
    for (int j = s; j >= a; j--) dp[j] = (dp[j] + dp[j - a]) % mod;
    (ans += dp[s]) % mod;
  }
  cout << ans << endl;
  return 0;
}
