#include <bits/stdc++.h>
using namespace std;
const long double PI = atan(1.0) * 4;
const int64_t INF = 3e18;
const int32_t LOG = 21;
const long long int MOD = 998244353;
long long int a[3005];
long long int dp[3005][3005];
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int tests = 1;
  for (long long int ii = 0; ii < tests; ii++) {
    long long int n, second;
    cin >> n >> second;
    for (long long int i = 1; i < n + 1; i++) cin >> a[i];
    if (a[1] < second) dp[1][a[1]] = 1;
    for (long long int i = 2; i < n + 1; i++) {
      for (long long int j = 0; j < second + 1; j++) {
        if (a[i] == j) {
          dp[i][j] = i + dp[i - 1][j];
          continue;
        }
        if (j - a[i] > 0)
          dp[i][j] = dp[i - 1][j] + dp[i - 1][j - a[i]];
        else
          dp[i][j] = dp[i - 1][j];
      }
    }
    long long int ans = 0;
    for (long long int i = 1; i < n + 1; i++) {
      ans += dp[i][second];
      while (ans >= MOD) ans -= MOD;
    }
    cout << ans << '\n';
  }
  return 0;
}
