#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, c = 0;
  cin >> n >> k;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  while (1) {
    for (int 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
      c++;
  }
  cout << c;
}
