#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector a(n), b(n); for(auto &&v:a)cin >> v; for(auto &&v:b)cin >> v; vector> dp(n + 1, vector(m + 1)); dp[n][0] = true; for(int i = n; i >= 1; i--){ int v = a[i - 1]; for(int j = 0; j <= m; j++){ if(dp[i][j]){ dp[i - 1][j] = true; if(j + v <= m)dp[i - 1][j + v] = true; } } } if(!dp[0][m]){ cout << -1 << '\n'; return 0; } int rem = m, st = 0; vector ans; while(rem){ int mn = n + 1, pos = -1; for(int i = st; i < n; i++){ if(rem < a[i])continue; if(dp[i][rem] && dp[i + 1][rem - a[i]]){ if(b[i] < mn){ mn = b[i]; pos = i; } } } st = pos + 1; rem -= a[pos]; ans.push_back(st); } cout << ans.size() << '\n'; for(int i = 0; i < ans.size(); i++){ cout << ans[i] << (i + 1 == ans.size() ? '\n' : ' '); } }