#include <bits/stdc++.h>
using namespace std;
using LLONG = long long;
const LLONG MOD = 998244353;
vector<int> As;
int N, S;
LLONG ans = 0LL;
void DFS(int L, int nextR, int sum) {
  for (int R = nextR; R < N; ++R) {
    int tmpSum = sum + As[R];
    if (tmpSum > S) {
      continue;
    } else if (tmpSum == S) {
      ans += (L + 1) * (N - R);
      ans %= MOD;
    } else {
      DFS(L, R + 1, tmpSum);
    }
  }
}
int main() {
  cin >> N >> S;
  As = vector<int>(N);
  for (auto &Ai : As) cin >> Ai;
  for (int L = 0; L < N; ++L) {
    if (As[L] == S) {
      ans += N;
      ans %= MOD;
    } else if (As[L] < S) {
      DFS(L, L + 1, As[L]);
    }
  }
  cout << ans << endl;
}
