#include <bits/stdc++.h>
using namespace std;
void logf(istream_iterator<string> it) {}
template <typename T, typename... Args>
void logf(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << endl;
  logf(++it, args...);
}
const double PI = acos(-1);
void solve() {
  int n;
  cin >> n;
  ;
  int s;
  cin >> s;
  ;
  vector<int> a(n);
  for (long long i = 0; i < (n); i++) {
    cin >> a[i];
  };
  set<pair<int, int> > seqs;
  int L = 0;
  int R = 0;
  int sum = 0;
  while (L < n) {
    while (R < n && sum < s) {
      sum += a[R];
      R++;
    }
    if (sum == s) {
      seqs.insert({L, R});
    }
    while (L < n && sum > s) {
      sum -= a[L];
      L++;
    }
    if (sum == s) {
      seqs.insert({L, R});
      sum -= a[L];
      L++;
    }
    if (sum < s && R >= n) break;
  }
  int ans = 0;
  for (pair<int, int> p : seqs) {
    ans += (p.first + 1) * (n - p.second + 1);
    ans %= 998244353;
  }
  cout << ans << endl;
}
int main() {
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  solve();
}
