#include using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) template bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} const long long mod=998244353; const long long mod2=469762049; int main(){ cout.tie()->sync_with_stdio(0); cin.tie(0); int N;cin>>N; ll B;cin>>B; pairC[N+1]; for(int i=1;i<=N;i++) cin>>C[i].first; for(int i=1;i<=N;i++) cin>>C[i].second; sort(C+1,C+N+1); /*for(int i=1;i<=N;i++) cout<=0); now_B-=(ruiseki[idx]-ruiseki[i]); now+=cnt[idx]-cnt[i]; idx++; if(idx<=N){ now+=now_B/C[idx].first; } chmax(ans,now); //cout<=0); now_B-=ruiseki[idx]; now+=cnt[idx]; idx++; if(idx<=N){ now+=now_B/C[idx].first; } chmax(ans,now); //cout<