#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int a[n], b[n];
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  int min = b[0] / a[0];
  for (int i = 0; i < n; i++) {
    if ((b[i] / a[i]) < min) min = b[i] / a[i];
  }
  while (k > 0) {
    int req = 0;
    for (int i = 0; i < n; i++) {
      if ((b[i] / a[i]) == min) req += ((a[i] * (min + 1)) - b[i]);
    }
    if (req > k) break;
    for (int i = 0; i < n; i++) {
      if ((b[i] / a[i]) == min) b[i] = a[i] * (min + 1);
    }
    min++;
    k -= req;
  }
  cout << min;
  return 0;
}
