#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <typename T, typename U>
pair<T, U> operator+(const pair<T, U>& l, const std::pair<T, U>& r) {
  return {l.first + r.first, l.second + r.second};
}
const long long ll mod = 998244353;
const long long ll MAX_NODES = 200001;
const long long ll MAX_LOG = 50;
const long long ll maxn = 400000 + 10;
long long ll power(long long ll x, long long ll n) {
  long long ll res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
  }
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, s;
  cin >> n >> s;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int ans = 0;
  vector<vector<long long ll> > dp(n + 1, vector<long long int>(s + 2, 0));
  dp[0][0] = 1;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j <= s + 1; j++) {
      dp[i + 1][j] = dp[i][j];
    }
    dp[i + 1][0]++;
    for (long long int j = a[i]; j <= s + 1; j++) {
      dp[i + 1][j] += dp[i][j - a[i]];
    }
    ans += (dp[i + 1][s]);
    ans %= mod;
  }
  cout << ans << '\n';
}
