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