#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  unordered_map<int, vector<int>> m;
  m[0].emplace_back(-1);
  long long result = 0;
  int p = 998244353;
  int csum = 0;
  for (int i = 0; i < n; ++i) {
    csum += a[i];
    if (m.find(csum - s) != m.end()) {
      for (auto x : m[csum - s]) {
        result += (x + 2) * (n - i);
        result %= p;
      }
    }
    m[csum].emplace_back(i);
  }
  cout << result;
  return 0;
}
