#include <bits/stdc++.h>
using namespace std;
void sortbyfirst(std::pair<int, int> &l, std::pair<int, int> &r) {}
void solve() {
  int n, k;
  cin >> n >> k;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  vector<pair<int, int> > vp, vp2;
  for (int i = 0; i < n; i++) {
    vp.push_back(make_pair(b[i] / a[i], a[i]));
    vp2.push_back(make_pair(b[i] / a[i], b[i] % a[i]));
  }
  sort(vp.begin(), vp.end());
  sort(vp2.begin(), vp2.end());
  vector<pair<int, int> >::iterator it = vp.begin();
  vector<pair<int, int> >::iterator it2 = vp2.begin();
  while (k > 0) {
    sort(vp.begin(), vp.end());
    sort(vp2.begin(), vp2.end());
    if (((it->second) - (it2->second)) <= k) {
      it->first++;
      it2->first++;
      k -= ((it->second) - (it2->second));
      it2->second = 0;
    } else
      break;
  }
  it = min_element(vp2.begin(), vp2.end());
  cout << it->first;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}
