#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000;
int ai[MAX_N], bi[MAX_N];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> ai[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> bi[i];
  }
  int ans = 0;
  while (true) {
    int ratio = 1000000;
    for (int i = 0; i < n; i++) {
      ratio = min(ratio, bi[i] / ai[i]);
    }
    ans += ratio;
    for (int i = 0; i < n; i++) {
      bi[i] -= ratio * ai[i];
    }
    bool flag = true;
    for (int i = 0; i < n; i++) {
      if (bi[i] / ai[i] == 0) {
        if (bi[i] + k < ai[i]) {
          flag = false;
          break;
        } else {
          k -= ai[i] - bi[i];
          bi[i] = ai[i];
        }
      }
    }
    if (!flag) break;
    for (int i = 0; i < n; i++) {
      bi[i] -= ai[i];
    }
    ans++;
  }
  cout << ans << endl;
  return 0;
}
