#include using namespace std; int main() { int N, M; cin >> N >> M; vector A(N); for (int i = 0; i < N; ++i) cin >> A[i]; vector> dp(N + 1, vector(M + 1, false)); dp[N][0] = true; for (int i = N - 1; i >= 0; --i) { for (int j = 0; j <= M; ++j) dp[i][j] = dp[i + 1][j]; for (int j = A[i]; j <= M; ++j) dp[i][j] = dp[i][j] || dp[i + 1][j - A[i]]; } if (!dp[0][M]) { puts("-1"); return 0; } vector P(N); for (int i = 0; i < N; ++i) { int a; cin >> a; P[a - 1] = i; } int sum = M; vector ans{-1}; while (sum != 0) { for (int i = 0; i < N; ++i) { if (ans.back() >= P[i]) continue; if (sum >= A[P[i]] && dp[P[i]][sum] && dp[P[i] + 1][sum - A[P[i]]]) { ans.push_back(P[i]); sum -= A[P[i]]; break; } } } cout << ans.size() - 1 << endl; for (int i = 1; i < ans.size(); ++i) cout << ans[i] + 1 << " \n"[i == ans.size() - 1]; }