#include <bits/stdc++.h>
using namespace std;
const int M = 998244353;
int n, top;
int a[3000];
stack<int> stc;
int dfs(int sum, int k) {
  int cnt = 0;
  for (int i = k; i < n; i++) {
    if (sum < a[i]) continue;
    stc.push(a[i]);
    if (stc.size() == 1) top = i;
    if (sum == a[i])
      cnt = (cnt + (top + 1) * (n - i)) % M;
    else
      cnt = (cnt + dfs(sum - a[i], i + 1)) % M;
    stc.pop();
  }
  return cnt;
}
int main() {
  int s;
  scanf("%d%d", &n, &s);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  printf("%d\n", dfs(s, 0));
  return 0;
}
