#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define pll pair<ll,ll>
int main() {
  ll N, T;
  cin >> N >> T; 
  ll arr[N];
  for (int i=0;i<N;i++){
    cin >> arr[i]; 
  } 
  ll total = 0; 
  deque<pll> sW; 
  ll curr = 0; 

  for (int i=0;i<N;i++){
    curr += arr[i]; 
    sW.push_back(make_pair(arr[i],i)); 
    while (curr > T){
      curr -= sW.front().first; 
      sW.pop_front(); 
    }
    if (curr == T){
      total += (sW.front().second + 1) * (N - i);
    }
    total %= 998244353; 
  } 
  cout << total; 


  