#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const long long LINF = 1ll << 60;
const int MOD = 1000000007;
int n, k;
pair<int, pair<int, int>> a[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i].second.first;
  for (int i = 0; i < n; i++) {
    cin >> a[i].second.second;
    a[i].first = a[i].second.second / a[i].second.first;
    a[i].second.second %= a[i].second.first;
  }
  sort(a, a + n);
  while (k) {
    int mi = a[0].first;
    for (int i = 0; i < n && a[i].first == mi; i++)
      if (a[i].second.first - a[i].second.second <= k) {
        a[i].first++;
        k -= a[i].second.first - a[i].second.second;
        a[i].second.second = 0;
      } else {
        k = 0;
        break;
      }
  }
  sort(a, a + n);
  cout << a[0].first;
  return 0;
}
