#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  vector<int> b(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int res = 0;
  while (k) {
    for (int i = 0; i < n; i++) {
      if (b[i] >= a[i])
        b[i] -= a[i];
      else {
        int dif = a[i] - b[i];
        if (k >= dif)
          k -= dif;
        else {
          cout << res;
          return 0;
        }
        b[i] = 0;
      }
    }
    res++;
  }
  cout << res;
  return 0;
}
