#include <bits/stdc++.h>
using namespace std;
const long long m = 1e9 + 7;
int n, k, a[2222], b[2222];
bool bb(int l) {
  int tmp = k;
  bool ok = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] * l <= b[i]) {
    } else {
      int kk = b[i] + tmp;
      tmp = 0;
      if (a[i] * l <= kk) {
        tmp += (kk - a[i] * l);
      } else {
        ok = 0;
        break;
      }
    }
  }
  return ok;
}
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 m = 0;
  for (int i = 0; i <= 2000; i++) {
    if (bb(i)) m = max(m, i);
  }
  cout << m << endl;
}
