#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long n, s, a[3004], ans = 0;
vector<pair<long long, long long> > dp[3004];
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = s - a[i]; j >= 0; j--) {
      for (auto k : dp[j]) {
        dp[j + a[i]].push_back({k.first, i});
      }
    }
    dp[a[i]].push_back({i, i});
  }
  cout << dp[1].size() << "\n";
  for (auto i : dp[s]) {
    ans += (i.first + 1) * (n - i.second);
    ans %= mod;
  }
  cout << ans << "\n";
}
