#include <bits/stdc++.h>
using namespace std;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const int INF = 1 << 29;
const long long INFL = 1LL << 60;
const long long mod = 998244353;
int n, s;
vector<int> a(3005);
vector<int> sa(3005, 0);
vector<pair<int, int>> p;
long long ans = 0;
void f(long long val, long long i, long long j) {
  if (val > s) return;
  if (val == s) {
    ans += (i + 1) * (n - j);
    if (ans >= mod) ans %= mod;
  } else {
    for (int k = int(j + 1); k < int(n); k++) {
      if (val + sa[k] < s) break;
      f(val + a[k], i, k);
    }
  }
}
int main() {
  cin >> n >> s;
  for (int i = 0; i < int(n); i++) cin >> a[i];
  sa[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    sa[i] = sa[i + 1] + a[i];
  }
  for (int i = 0; i < int(n); i++) {
    f(a[i], i, i);
  }
  cout << ans << endl;
}
