#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  int n, k;
  cin >> n >> k;
  vector<int> ing(n);
  vector<int> pr(n);
  for (int i = 0; i < n; i++) {
    cin >> pr[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> ing[i];
  }
  while (1) {
    for (int i = 0; i < n; i++) {
      if (ing[i] >= pr[i]) {
        ing[i] = ing[i] - pr[i];
      } else {
        if (k >= abs(pr[i] - ing[i])) {
          k -= abs(pr[i] - ing[i]);
          ing[i] = 0;
        } else {
          cout << ans;
          return 0;
        }
      }
    }
    ans++;
  }
}
