#include <bits/stdc++.h>
int n, m, ans = 0x7fffffff, a[100005], b[100005];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++)
    scanf("%d", &b[i]), ans = std::min(ans, b[i] / a[i]);
  for (int i = 1; i <= n; i++) b[i] -= a[i] * ans;
  while (m > 0) {
    for (int i = 1; i <= n; i++)
      if (b[i] < a[i])
        m -= a[i] - b[i], b[i] = 0;
      else
        b[i] -= a[i];
    if (m >= 0) ans++;
  }
  printf("%d", ans);
}
