#include<bits/stdc++.h>
using namespace std;
int n, s;
vector<int> arr;
vector<int> t;

void build(int v, int tl, int tr) {
  if(tl == tr) {
    t[v] = arr[tl];
    return;
  }
  
  int tm = (tl + tr) / 2;
  build(v*2, tl, tm);
  build(v*2 + 1, tm+1, tr);
  t[v] = t[v*2] + t[v*2 + 1];
}

int sum(int v, int tl, int tr, int l, int r) {
  if(l > r)
    return 0;
  if(tl == l && tr == r)
    return t[v];
  
  int tm = (tl + tr) / 2;
  return ((sum(v*2, tl, tm, l, min(r,tm)) + sum(v*2 + 1, tm+1, tr, max(l,tm+1), r));
}

int main() {
  cin >> n >> s;
  
  arr.resize(n);
  t.resize(4*n);
  
  for(auto &x: arr)
    cin >> x;
  
  build(1, 0, n-1);
  
  vector<pair<int,int>> ans;
  for(int i=0; i<n; i++) {
    for(int j=i; j<n; j++) {
      int res = sum(1, 0, n-1, i, j);
      if(res == s)
        ans.emplace_back(i,j);
    }
  }
  
  long long qwe = 0;
  for(int i=n-1; i>=0; i--) {
    int x = ans.size();
    qwe = (qwe + ((x * (x+1)) / 2)) % 998244353;
    
    for(int j=x; j>=0; j--) {
      if(ans.second >= i)
        ans.pop_back();
    }
  }
  
  cout << qwe << endl;
  
  return 0;
}