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