#include <bits/stdc++.h>
using namespace std;
const long long oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
const long long MOD = 998244353;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, s;
  cin >> n >> s;
  vector<long long> a(n);
  for (long long i = (0); i < (n); i++) cin >> a[i];
  long long res = 0;
  vector<long long> dp(s + 1);
  for (long long i = (0); i < (n); i++) {
    vector<long long> ndp = dp;
    ndp[a[i]] = (ndp[a[i]] + i + 1) % MOD;
    for (long long j = (a[i]); j < (s + 1); j++) {
      ndp[j] = (ndp[j] + dp[j - a[i]]) % MOD;
    }
    dp = ndp;
    res = (res + dp[s]) % MOD;
  }
  cout << res << endl;
}
