#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
  long long s = 1;
  while (y > 0) {
    if (y & 1) s = (s * x) % p;
    x = (x * x) % p;
    y /= 2;
  }
  return s;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int n, k, a[1002], b[1002], res = 0, mn = 1001;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]), mn = min(mn, b[i] / a[i]);
  if (mn != 1001) res = mn;
  for (int i = 1; i <= n; i++) b[i] -= a[i] * res;
  while (k != 0) {
    for (int i = 1; i <= n; i++) {
      if (a[i] > b[i]) {
        if (abs(a[i] - b[i]) > k) return printf("%d", res), 0;
        k -= abs(a[i] - b[i]);
        b[i] = a[i];
      }
    }
    res++;
    for (int i = 1; i <= n; i++) b[i] -= a[i];
  }
  printf("%d", res);
  return 0;
}
