#include <bits/stdc++.h>
const int INF_INT = 0x3f3f3f3f;
const long long INF_LL = 0x7f7f7f7f;
const int MOD = 1e9 + 7;
const double eps = 1e-10;
const double pi = acos(-1);
using namespace std;
int n, k;
int a[1010], b[1010];
struct P {
  int id;
  int num;
  int rest;
  bool operator<(const P& rhs) const {
    if (num == rhs.num)
      return a[id] - rest > a[rhs.id] - rhs.rest;
    else
      return num > rhs.num;
  }
};
P p[1010];
int main(int argc, char const* argv[]) {
  while (scanf("%d%d", &n, &k) == 2) {
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int j = 1; j <= n; j++) scanf("%d", &b[j]);
    for (int i = 1; i <= n; i++) {
      p[i].id = i;
      p[i].num = b[i] / a[i];
      p[i].rest = b[i] % a[i];
    }
    priority_queue<P> q;
    for (int i = 1; i <= n; i++) q.push(p[i]);
    int ans = 0;
    P now;
    while (k > 0) {
      now = q.top();
      q.pop();
      int tmp = min(k, a[now.id] - now.rest);
      k -= tmp;
      now.rest += tmp;
      if (now.rest >= a[now.id]) {
        now.num++;
        now.rest %= a[now.id];
      }
      q.push(now);
    }
    ans = q.top().num;
    cout << ans << endl;
  }
  return 0;
}
