#include #include #include using namespace atcoder; using namespace std; using ll = long long; using mint = modint998244353; int main(){ ll N, K; cin >> N >> K; vector C(N), D(N); for (int i=0; i> C[i]; for (int i=0; i> D[i]; vector> dp(K+1, {-1e18, 0}); dp[0] = {0, 1}; for (int i=0; i<=K; i++){ for (int j=0; j mx){ mx = a; ans = b; } } cout << mx << endl; cout << ans.val() << endl; return 0; }