#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll LINF = 1001002003004005006ll;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
ll n, s;
ll a[3001];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin >> n >> s;
  for (int i = 0; i < (n); i++) cin >> a[i];
  int sz = 1;
  while (sz < n) sz <<= 1;
  vector<map<ll, ll>> cnt(sz);
  for (int i = 0; i < (sz); i++) {
    cnt[i][0] = 1;
    if (i >= n) continue;
    cnt[i][a[i]]++;
  }
  while (sz > 1) {
    sz >>= 1;
    vector<map<ll, ll>> cnt_new(sz);
    for (int i = 0; i < (sz); i++) {
      for (auto l : cnt[2 * i]) {
        cnt_new[i][l.first] += cnt[2 * i][l.second];
        cnt_new[i][l.first] %= 998244353;
      }
      for (auto r : cnt[2 * i + 1]) {
        cnt_new[i][r.first] += cnt[2 * i + 1][r.second];
        cnt_new[i][r.first] %= 998244353;
      }
      for (auto l : cnt[2 * i]) {
        for (auto r : cnt[2 * i + 1]) {
          cnt_new[i][l.first + r.first] += (l.second * r.second) % 998244353;
          cnt_new[i][l.first + r.first] %= 998244353;
        }
      }
    }
    swap(cnt, cnt_new);
  }
  for (auto x : cnt[0]) {
    cout << x.first << " " << x.second << endl;
  }
  cout << cnt[0][s] << endl;
  return 0;
}
