#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int N = 1010;
const int MAX = 1000000100;
const int mod = 100000000;
const int MOD1 = 1000000007;
const int MOD2 = 1000000009;
const double EPS = 0.00000001;
const long long MOD = 998244353;
const int INF = 1000000010;
int a[N], b[N];
int main() {
  int i, j, n, k;
  long long kk;
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (i = 1; i <= 2000; i++) {
    kk = (long long)k;
    for (j = 1; j <= n; j++)
      if (a[j] * i > b[j]) kk -= a[j] * i - b[j];
    if (kk < 0) break;
  }
  printf("%d\n", i - 1);
  return 0;
}
