#include <bits/stdc++.h>
int gi() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
long long T;
int tot[100010], t[100010], ut[100010], u;
int fir[100010], dis[100010], nxt[100010], w[100010], id;
void link(int a, int b, int c) {
  nxt[++id] = fir[a], fir[a] = id, dis[id] = b, w[id] = c;
}
long long sum[10000010], Sum[10000010];
int f[100010];
void update(int x, int l, int r, const int& p, const int& d) {
  Sum[x] += 1ll * ut[p] * d, sum[x] += d;
  if (l == r) return;
  if (p <= ((l + r) >> 1))
    update(x << 1, l, ((l + r) >> 1), p, d);
  else
    update(x << 1 | 1, ((l + r) >> 1) + 1, r, p, d);
}
long long M;
long long Query(int x, int l, int r) {
  if (l == r) {
    long long ret = std::min(M / ut[l], sum[x]);
    return M -= ret * ut[l], ret;
  }
  if (M <= Sum[x << 1])
    return Query(x << 1, l, ((l + r) >> 1));
  else
    return M -= Sum[x << 1],
           sum[x << 1] + Query(x << 1 | 1, ((l + r) >> 1) + 1, r);
}
void DFS(int x, long long LEN = 0) {
  if (LEN > T) return;
  update(1, 1, u, t[x], tot[x]);
  M = T - 2 * LEN;
  f[x] = Query(1, 1, u);
  int mx = 0, cmx = 0;
  for (int i = fir[x]; i; i = nxt[i]) {
    DFS(dis[i], LEN + w[i]);
    if (f[dis[i]] > mx)
      cmx = mx, mx = f[dis[i]];
    else if (f[dis[i]] > cmx)
      cmx = f[dis[i]];
  }
  f[x] = std::max(f[x], cmx);
  update(1, 1, u, t[x], -tot[x]);
}
int main() {
  int n = gi();
  scanf("%lld", &T);
  for (int i = 1; i <= n; ++i) tot[i] = gi();
  for (int i = 1; i <= n; ++i) t[i] = ut[i] = gi();
  std::sort(ut + 1, ut + n + 1), u = std::unique(ut + 1, ut + n + 1) - ut - 1;
  for (int i = 1; i <= n; ++i)
    t[i] = std::lower_bound(ut + 1, ut + u + 1, t[i]) - ut;
  int fa, len;
  for (int i = 2; i <= n; ++i) fa = gi(), len = gi(), link(fa, i, len);
  DFS(1);
  int ans = f[1];
  for (int i = fir[1]; i; i = nxt[i]) ans = std::max(ans, f[dis[i]]);
  printf("%d\n", ans);
  return 0;
}
