#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using i32 = int32_t;
int main() {
  const i64 mod = 998244353;
  i64 n, s;
  cin >> n >> s;
  vector<i64> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<i64> dp(s + 1);
  i64 ans = 0, i = 1;
  for (i64 x : a) {
    for (i64 i = s - x; i > 0; --i) {
      dp[i + x] += dp[i];
      dp[i + x] %= mod;
    }
    dp[x] += i;
    ans += dp[s];
    ++i;
  }
  cout << ans << endl;
  return 0;
}
