#include <iostream>
#include<bits/stdc++.h>

using namespace std;



int main() {
	// your code goes here
    int n;
    cin>>n;
    int budget;
    cin>>budget;
    
    vector<int> composition(n);
    vector<int> stock(n);
    vector<int> cost(n);
    
    
    for(int i=0;i<n;i++){
    	cin>>composition[i];
    }
    
    for(int i=0;i<n;i++){
    	cin>>stock[i];
    }
    
    
    for(int i=0;i<n;i++){
    	cin>>cost[i];
    }
    
    	
    
    bool val=false;
    int unit=1;
    int ans=0;
    
    
    while(val==false){
    	int need=0;
    	int totalcost=0;
    	
    	
    	for(int i=0;i<n;i++){
    	 need = composition[i]*unit - stock[i];
    	 if(need<0){
    	 	need=0;
    	 }
    	 totalcost=totalcost+need*cost[i];
    	 
    	 
    	}
    	
    	if(totalcost>budget){
    		val=true;
    		
    	}
    	else{
    		ans=unit;
    	}
    	unit++;
    	
    }
    
    cout<<ans;
    
    
    
    
	return 0;
}