#include <bits/stdc++.h>
using namespace std;
int a[10000], b[10000];
vector<pair<int, int> > v;
int main() {
  int n, k, ans = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    v.push_back(make_pair(b[i] / a[i], i));
    b[i] = b[i] % a[i];
  }
  sort(v.begin(), v.end());
  int u = 0, t = 0;
  while (true) {
    t = INFINITY;
    for (int i = 0; i < n; i++) {
      if (t > v[i].first) {
        u = i;
        t = v[i].first;
      }
    }
    k -= (a[v[u].second] - b[v[u].second]);
    if (k < 0) break;
    b[v[u].second] = 0;
    v[u].first++;
  }
  ans = INFINITY;
  for (int i = 0; i < n; i++) ans = min(v[i].first, ans);
  cout << ans;
  return 0;
}
