#include <bits/stdc++.h>
using namespace std;
long long val[1000005 << 2], cnt[1000005 << 2];
void ins(long long rt, long long l, long long r, long long num, long long t) {
  val[rt] += t * num, cnt[rt] += num;
  if (l == r) return;
  long long mid = (l + r) >> 1;
  if (t <= mid)
    ins(rt << 1, l, mid, num, t);
  else
    ins(rt << 1 | 1, mid + 1, r, num, t);
}
long long get(long long rt, long long l, long long r, long long t) {
  if (val[rt] <= t) return cnt[rt];
  if (l == r) return t / r;
  long long mid = (l + r) >> 1;
  if (val[rt << 1] >= t) return get(rt << 1, l, mid, t);
  return get(rt << 1 | 1, mid + 1, r, t - val[rt << 1]) + cnt[rt << 1];
}
long long xi[100005], ti[100005];
struct Node {
  int v, w;
} st;
vector<Node> e[100005];
long long dfs(long long u, long long t) {
  ins(1, 1, 1000000, xi[u], ti[u]);
  long long f1 = get(1, 1, 1000000, t);
  long long f2 = 0, f3 = 0;
  for (auto now : e[u]) {
    if (t <= now.w * 2) continue;
    long long v = now.v;
    long long tmp = dfs(v, t - 2 * now.w);
    if (tmp > f2)
      f3 = f2, f2 = tmp;
    else if (tmp > f3)
      f3 = tmp;
  }
  ins(1, 1, 1000000, -xi[u], ti[u]);
  if (u == 1) return max(f1, f2);
  return max(f1, f3);
}
int main() {
  long long n, t, u;
  scanf("%lld%lld", &n, &t);
  for (long long i = 1; i <= n; ++i) scanf("%lld", &xi[i]);
  for (long long i = 1; i <= n; ++i) scanf("%lld", &ti[i]);
  for (long long i = 2; i <= n; ++i) {
    scanf("%lld%lld", &u, &st.w);
    st.v = i;
    e[u].push_back(st);
  }
  printf("%lld\n", dfs(1, t));
  return 0;
}
