#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[1001], b[1001];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int mc = 0;
  for (int i = 1; i <= 2000; i++) {
    int cnt = 0;
    bool ok = true;
    for (int j = 0; j < n; j++) {
      if (b[j] / a[j] >= i) continue;
      cnt += (i * a[j] - b[j]);
      if (cnt > k) {
        ok = false;
        break;
      }
    }
    if (ok) mc = i;
  }
  cout << mc;
  return 0;
}
