#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int ar[n];
  int br[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> br[i];
  }
  int mn = 1e9;
  int sum = 0;
  int p = 0;
  while (1) {
    for (int i = 0; i < n; i++) {
      if (ar[i] > br[i] && k < (ar[i] - br[i])) {
        p = 1;
      } else if (ar[i] > br[i] && k >= (ar[i] - br[i])) {
        k = k - (ar[i] - br[i]);
        br[i] = ar[i];
      }
      mn = min(mn, (br[i] / ar[i]));
    }
    if (p == 1) break;
    for (int i = 0; i < n; i++) {
      br[i] -= (ar[i] * mn);
    }
    sum = sum + mn;
  }
  cout << sum << endl;
}
