#include <bits/stdc++.h>
using namespace std;
long long pw(long long b, long long r, long long md) {
  long long ans = 1;
  while (r) {
    if (r & 1) ans = (ans * b) % md;
    b = (b * b) % md;
    r >>= 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, s;
  cin >> n >> s;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long dp[n][s + 1];
  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  if (arr[0] <= s) dp[0][arr[0]] = 1;
  cout << dp[0][0] << endl;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= s; j++) dp[i][j] = dp[i - 1][j];
    for (int j = arr[i]; j <= s; j++) {
      dp[i][j] += dp[i - 1][j - arr[i]];
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= s; j++) cout << dp[i][j] << " ";
    cout << endl;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      if (i == j) {
        if (arr[i] == s) ans = (ans + ((i + 1) * (n - i))) % 998244353;
      } else {
        if (arr[i] + arr[j] == s)
          ans = (ans + ((i + 1) * (n - j))) % 998244353;
        else if (arr[i] + arr[j] < s) {
          if (dp[j - 1][s - (arr[i] + arr[j])] - dp[i][s - (arr[i] + arr[j])] >
              0) {
            ans = (ans + ((i + 1) * (n - j))) % 998244353;
          }
        }
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
