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