#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int i, j, k;
  int t;
  int a[10100], b[10100];
  int minm = 10010;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &b[i]);
    minm = (b[i] / a[i]) < minm ? (b[i] / a[i]) : minm;
  }
  int ans = minm;
  for (i = minm + 1; i <= 10000; ++i) {
    int need = 0;
    for (j = 1; j <= n; ++j) {
      t = a[j] * i - b[j];
      need += (t > 0 ? t : 0);
    }
    if (need <= m)
      ans = i;
    else
      break;
  }
  printf("%d\n", ans);
  return 0;
}
