#include <bits/stdc++.h>
using namespace std;
int const N = 1005;
int const INF = 1e9 + 7;
int n, k;
pair<int, int> a[N];
int ans;
int main() {
  cin >> n >> k;
  for (int c = 1; c <= n; c++) {
    cin >> a[c].first;
  }
  for (int c = 1; c <= n; c++) {
    cin >> a[c].second;
  }
  while (1) {
    bool can = true;
    for (int c = 1; c <= n; c++) {
      if (a[c].second >= a[c].first) {
        a[c].second -= a[c].first;
      } else {
        int x = a[c].first - a[c].second;
        if (k < x) {
          can = false;
          break;
        } else {
          k -= x;
          a[c].second = 0;
        }
      }
    }
    if (!can) break;
    ans++;
  }
  cout << ans;
  return 0;
}
