#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long maxn = 2e5 + 20;
const long long inf = (long long)2e9;
const long double pi = 3.14159265358979323846264;
const long double eps = 1e-8;
const long long mod = 998244353;
const long long ns = 97;
random_device rd;
mt19937 SuperRandom(rd());
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n, s;
  cin >> n >> s;
  vector<long long> goo(n);
  for (auto& x : goo) cin >> x;
  vector<vector<long long>> dp(n + 1, vector<long long>(s + 10));
  long long ans = 0;
  for (long long i = 1; i <= n; ++i) {
    long long x = goo[i - 1];
    dp[i][x] = i;
    for (long long j = 0; j <= s; ++j) {
      dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
      if (j - x >= 0) {
        dp[i][j] = (dp[i][j] + dp[i - 1][j - x]) % mod;
      }
    }
    ans = (ans + dp[i][s]) % mod;
  }
  cout << ans;
}
