#include <bits/stdc++.h>
using namespace std;
const int N = 1e9;
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n], b[n], d[n];
  vector<pair<long long, long long> > c(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    c[i].first = b[i] / a[i];
    c[i].second = i;
    d[i] = b[i] % a[i];
  }
  sort(c.begin(), c.end());
  while (k > 0) {
    int x = a[c[0].second] - d[c[0].second];
    if (x <= k) {
      d[c[0].second] = 0;
      k -= x;
      c[0].first++;
    } else
      k = 0;
    sort(c.begin(), c.end());
  }
  cout << c[0].first;
}
