#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int n, k;
  cin >> n >> k;
  long long int arr1[n], arr2[n];
  for (long long int i = 0; i < n; i++) cin >> arr1[i];
  for (long long int i = 0; i < n; i++) cin >> arr2[i];
  multiset<pair<long long int, pair<long long int, long long int> > > s;
  for (long long int i = 0; i < n; i++) {
    s.insert(make_pair(arr2[i] / arr1[i], make_pair(arr1[i], arr2[i])));
  }
  multiset<pair<long long int, pair<long long int, long long int> > >::iterator
      it1;
  while (true) {
    pair<long long int, pair<long long int, long long int> > pp = *s.begin();
    long long int num = pp.first, a = pp.second.first, b = pp.second.second;
    long long int req = a - (b % a);
    if (k >= req) {
      k -= req;
      s.erase(s.begin());
      s.insert(make_pair(num + 1, make_pair(a, b + req)));
    } else {
      break;
    }
  }
  it1 = s.begin();
  cout << it1->first;
}
