#include using namespace std; //#include //using namespace atcoder; using ll = long long int; using ull = unsigned long long int; using ld = long double; constexpr ll MAX = 2000000000000000000; constexpr ld PI = 3.14159265358979; constexpr ll MOD = 998244353;//2024948111; ld dotorad(ld K){return PI * K / 180.0;} ld radtodo(ld K){return K * 180.0 / PI;} mt19937 mt; void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());} int main(){ ll N,M; cin >> N >> M; vector A(N),P(N); for(ll i = 0;i < N;i++) cin >> A[i]; for(ll i = 0;i < N;i++) cin >> P[i]; vector ans; ll ans_s = M,l = -1; while(ans_s > 0){ bitset<3000> b; b.set(0); tuple a = make_tuple(MAX,-1); for(ll i = N - 1;i > l;i--){ if(ans_s - A[i] >= 0 && b[ans_s - A[i]]){ a = min(a,make_tuple(P[i],i)); } b |= (b << A[i]); } l = get<1>(a); if(l == -1){ cout << -1 << endl; return 0; } ans.emplace_back(l + 1); ans_s -= A[l]; } cout << (ll)ans.size() << endl; for(ll i = 0;i < (ll)ans.size();i++) cout << ans[i] << " \n"[i == (ll)ans.size() - 1]; }