#include <bits/stdc++.h>
using namespace std;
struct debug_t {
  template <typename T>
  debug_t& operator<<(const T& value) {
    return *this;
  }
  debug_t& write(const char data[], size_t n) { return *this; }
} debug;
int a[1000], b[1000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int i, n, k;
  while (cin >> n >> k) {
    for (i = 0; i < n; i++) cin >> a[i];
    for (i = 0; i < n; i++) cin >> b[i];
    int result = 0;
    while (true) {
      for (i = 0; i < n; i++) {
        b[i] -= a[i];
        if (b[i] < 0) {
          k += b[i];
          if (k < 0) goto done;
          b[i] = 0;
        }
      }
      result++;
    }
  done:
    cout << result << '\n';
  }
}
