#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int qntn[N], qntp[N], ing[N], sobra[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> qntn[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> qntp[i];
  }
  bool end = false;
  while (k) {
    int qnt_min;
    for (int i = 0; i < n; i++) {
      ing[i] = qntp[i] / qntn[i];
      sobra[i] = qntp[i] % qntn[i];
      if (i == 0) qnt_min = ing[i];
      qnt_min = min(qnt_min, ing[i]);
    }
    for (int i = 0; i < n; i++) {
      if (qnt_min == ing[i]) {
        if (k >= qntn[i] - sobra[i]) {
          ing[i]++;
          k -= qntn[i] - sobra[i];
          qntp[i] += qntn[i] - sobra[i];
          sobra[i] = 0;
        } else {
          end = true;
          break;
        }
      }
    }
    if (end) break;
  }
  sort(ing, ing + n);
  cout << ing[0];
  return 0;
}
