#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, i, j, l, mn;
  cin >> n >> k;
  mn = 100000000;
  int a[n], b[n];
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) cin >> b[i];
  while (k > 0) {
    for (i = 1; i <= n; i++) {
      if (mn > b[i] / a[i]) {
        mn = b[i] / a[i];
        l = i;
      }
    }
    mn = 100000000;
    b[l]++;
    k--;
  }
  for (i = 1; i <= n; i++)
    if (mn > b[i] / a[i]) {
      mn = b[i] / a[i];
      l = i;
    }
  cout << mn;
  return 0;
}
