#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[1001], b[1001];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  int ans = 0;
  while (1) {
    int flog = 1;
    for (int i = 1; i <= n; i++) {
      b[i] -= a[i];
      if (b[i] < 0 && b[i] + k >= 0) {
        k += b[i];
        b[i] = 0;
      }
      if (b[i] < 0) {
        flog = 0;
        break;
      }
    }
    if (flog == 0)
      break;
    else
      ans++;
  }
  cout << ans << endl;
}
