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