#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int a[1005], b[1005];
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  int res = b[1] / a[1];
  for (int i = 1; i <= n; i++) res = min(res, b[i] / a[i]);
  int cur = res;
  for (int i = res; i <= res + k; i++) {
    int temp = k;
    for (int j = 1; j <= n; j++) {
      if (i * a[j] > b[j]) {
        temp -= (i * a[j] - b[j]);
      }
    }
    if (temp >= 0) cur = i;
  }
  cout << cur;
  return 0;
}
