#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const ll MOD = 998244353;
const ll inf = 1e18;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  ll n, s;
  cin >> n >> s;
  vll a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vvll dp(n + 1, vll(3010));
  ll res = 0;
  for (int i = 0; i < n; i++) {
    dp[i + 1][a[i]] = i + 1;
    dp[i + 1][a[i]] %= MOD;
    for (int j = s + 1 - 1; j >= 0; j--) {
      if (j == 0) continue;
      dp[i + 1][j] += dp[i][j];
      if (j + a[i] > s) continue;
      dp[i + 1][j + a[i]] += dp[i][j];
      dp[i + 1][j + a[i]] %= MOD;
    }
    res += dp[i + 1][s];
  }
  cout << res << endl;
  return 0;
}
