#include <bits/stdc++.h>
const int d[8][2] = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
                     {0, 1},   {1, -1}, {1, 0},  {1, 1}};
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
using namespace std;
int n, k;
int a[1110];
int b[1110];
long long cnt;
long long ans;
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 l = 0, r = 100000;
  while (r - l > 1) {
    int m = (l + r) / 2;
    long long cnt = 0;
    for (int i = 0; i < n; i++) {
      if (b[i] < a[i] * m) cnt += a[i] * m - b[i];
    }
    if (cnt <= k)
      l = m;
    else
      r = m;
  }
  cout << l;
}
