#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
int n;
long long k;
int a[11111], b[11111];
void basic() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  long long l = 0, r = 11111, ans = 0;
  while (l < r) {
    long long m = (l + r + 1) >> 1;
    long long q = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] * m > b[i]) q += m * a[i] - b[i];
    }
    if (q == k) {
      ans = m;
      break;
    }
    if (q > k)
      r = m - 1;
    else {
      ans = l = m;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  basic();
  getchar();
  getchar();
  return 0;
}
