#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
int dp[101][10001],zm;
pair<int,int>t[101];
vector<int>wyn;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,B;
cin>>n>>B;
for(int i=1;i<=n;i++) cin>>t[i].F;
for(int i=1;i<=n;i++) cin>>t[i].S;
//sort(t[i],t[i]+n)
for(int i=1;i<=n;i++){
for(int j=1;j<=B;j++){
if(j-t[i].F>=0) dp[i][j]=max(dp[i-1][j],dp[i-1][j-t[i].F]+t[i].S);
else dp[i][j]=dp[i-1][j];
}
}
cout<<dp[n][B]<<"\n";
int l=B,k=n;
while(dp[k][l]!=0){
if(dp[k][l]!=dp[k-1][l]){
zm++; wyn.push_back(k); l-=t[k].F;
}
k--;
}
cout<<zm<<"\n";
for(int i:wyn) cout<<i<<' ';
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBGIGZpcnN0IAojZGVmaW5lIFMgc2Vjb25kIAp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgZHBbMTAxXVsxMDAwMV0sem07CnBhaXI8aW50LGludD50WzEwMV07CnZlY3RvcjxpbnQ+d3luOwoKaW50IG1haW4oKXsKCWlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oMCk7CgljaW4udGllKDApOwoJY291dC50aWUoMCk7CglpbnQgbixCOwoJY2luPj5uPj5COwoJZm9yKGludCBpPTE7aTw9bjtpKyspIGNpbj4+dFtpXS5GOwoJZm9yKGludCBpPTE7aTw9bjtpKyspIGNpbj4+dFtpXS5TOwoJLy9zb3J0KHRbaV0sdFtpXStuKQoJZm9yKGludCBpPTE7aTw9bjtpKyspewoJCWZvcihpbnQgaj0xO2o8PUI7aisrKXsKCQkJaWYoai10W2ldLkY+PTApIGRwW2ldW2pdPW1heChkcFtpLTFdW2pdLGRwW2ktMV1bai10W2ldLkZdK3RbaV0uUyk7CgkJCWVsc2UgZHBbaV1bal09ZHBbaS0xXVtqXTsKCQl9Cgl9Cgljb3V0PDxkcFtuXVtCXTw8IlxuIjsKCWludCBsPUIsaz1uOwoJd2hpbGUoZHBba11bbF0hPTApewoJCWlmKGRwW2tdW2xdIT1kcFtrLTFdW2xdKXsKCQkJem0rKzsgd3luLnB1c2hfYmFjayhrKTsgIGwtPXRba10uRjsKCQl9CgkJay0tOwoJfQoJY291dDw8em08PCJcbiI7Cglmb3IoaW50IGk6d3luKSBjb3V0PDxpPDwnICc7Cn0=