#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
const ll INF = 9e18;
void print() { cout << endl; }
template <typename Head, typename... Tail>
void print(Head head, Tail... tail) {
  cout << head;
  if (sizeof...(Tail) > 0) cout << " ";
  print(tail...);
}
void print0() {}
template <typename Head, typename... Tail>
void print0(Head head, Tail... tail) {
  cout << head;
  print0(tail...);
}
ll MODULO = 998244353;
template <class T>
class bsegment_tree {
 public:
  ll size;
  vector<T> data;
  T default_value;
  bsegment_tree(ll n, T default_value_) {
    default_value = default_value_;
    ll siz = 1;
    while (siz < n) {
      siz = siz * 2;
    }
    data.resize(siz * 2, default_value);
    size = siz;
  }
  ~bsegment_tree() {}
  T compare(T& a, T& b) { return (a + b) % MODULO; }
  void update(ll k, T value) {
    k += size - 1;
    data[k] = value;
    while (k > 0) {
      k = (k - 1) / 2;
      data[k] = compare(data[k * 2 + 1], data[k * 2 + 2]);
    }
  }
  T query(ll a, ll b, ll k, ll l, ll r) {
    if (r <= a || b <= l) {
      return default_value;
    }
    if (a <= l && r <= b) {
      return data[k];
    }
    T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return compare(vl, vr);
  }
  T query(ll a, ll b) { return query(a, b, 0, 0, size); }
};
using cnttree = bsegment_tree<ll>;
template <class T>
class dsegment_tree {
 public:
  ll size;
  vector<T> data;
  T default_value;
  dsegment_tree(ll n, T default_value_) {
    default_value = default_value_;
    ll siz = 1;
    while (siz < n) {
      siz = siz * 2;
    }
    data.resize(siz * 2, default_value);
    size = siz;
  }
  ~dsegment_tree() {}
  T compare(T& a, T& b) { return a + b; }
  void update(ll k, T value) {
    k += size - 1;
    data[k] = value;
    while (k > 0) {
      k = (k - 1) / 2;
      data[k] = compare(data[k * 2 + 1], data[k * 2 + 2]);
    }
  }
  T query(ll a, ll b, ll k, ll l, ll r) {
    if (r <= a || b <= l) {
      return default_value;
    }
    if (a <= l && r <= b) {
      return data[k];
    }
    T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return compare(vl, vr);
  }
  T query(ll a, ll b) { return query(a, b, 0, 0, size); }
};
using sumtree = dsegment_tree<ll>;
ll mod(ll x) { return x % MODULO; }
int main() {
  ll N, S;
  cin >> N >> S;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll total = 0;
  for (ll L = 0; L < N; L++) {
    for (ll R = L; R < N; R++) {
      vector<ll> sumdp(3002, 0);
      for (ll i = L; i <= R; i++) {
        for (ll cnt = 3002; cnt > 0; cnt--) {
          ll nextcnt = cnt + A[i];
          if (nextcnt >= 3002) {
            continue;
          }
          sumdp[nextcnt] = mod(sumdp[nextcnt] + sumdp[cnt]);
        }
        sumdp[A[i]]++;
      }
      total = mod(total + sumdp[S]);
    }
  }
  print(total);
}
