#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, k;
  long long int n, count = 0;
  cin >> n >> k;
  long long int a[n], b[n];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  long long int Min = 1000000000000;
  for (i = 0; i < n; i++) {
    if (b[i] / a[i] < Min) Min = b[i] / a[i];
  }
  count = Min;
  for (i = 0; i < n; i++) {
    b[i] -= (count * a[i]);
  }
  long long int need;
  while (k) {
    need = 0;
    for (i = 0; i < n; i++) {
      if (b[i] < a[i]) need += (a[i] - b[i]);
    }
    if (k >= need) {
      count++;
      for (i = 0; i < n; i++) {
        b[i] -= a[i];
        if (b[i] < 0) b[i] = 0;
      }
      k -= need;
    } else
      k = 0;
  }
  cout << count;
  return 0;
}
