#include <bits/stdc++.h>
using namespace std;
long long pounds = 0, number = 0;
long long num(vector<long long> vec, long long y) {
  long long l = 0, r = 10000, ans = 0, si = vec.size() / 2;
  while (r >= l) {
    long long mid = (l + r) / 2, sum = 0, a, b, c;
    for (int i = 0; i < si; i++) {
      long long z = (mid * vec[i]) - vec[si + i];
      if (z < 0) z = 0;
      sum += z;
    }
    if (sum > y) {
      r = mid - 1;
    } else {
      ans = mid;
      l = mid + 1;
    }
  }
  return ans;
}
int main() {
  int x, y;
  cin >> x >> y;
  vector<long long> vec(2 * x);
  for (long long &i : vec) cin >> i;
  cout << num(vec, y) << endl;
  return 0;
}
