#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
struct Edge {
  int to, next, v;
} a[100010];
int h[100010], cnt, n, X[100010], T[100010], mx[100010], se[100010],
    val[100010], u[100010 << 6];
void add(int x, int y, int z) { a[++cnt] = (Edge){y, h[x], z}, h[x] = cnt; }
long long s[100010 << 6], t;
void ins(int k, int l, int r, int p, int vl) {
  s[k] += 1ll * p * vl, u[k] += vl;
  if (l == r) return;
  int mid = l + r >> 1;
  p > mid ? ins(k << 1 | 1, mid + 1, r, p, vl) : ins(k << 1, l, mid, p, vl);
}
int ask(int k, int l, int r, long long vl) {
  if (l == r) return min(1ll * u[k], vl / l);
  int mid = l + r >> 1;
  if (vl < s[k << 1])
    return ask(k << 1, l, mid, vl);
  else
    return u[k << 1] + ask(k << 1 | 1, mid + 1, r, vl - s[k << 1]);
}
void Dfs(int x, long long vl) {
  ins(1, 1, 1e6, T[x], X[x]), val[x] = ask(1, 1, 1e6, vl);
  for (int i = h[x], tmp; i; i = a[i].next)
    if ((a[i].v << 1) < vl) {
      Dfs(a[i].to, vl - (a[i].v << 1)), tmp = max(se[a[i].to], val[a[i].to]);
      if (tmp > mx[x])
        se[x] = mx[x], mx[x] = tmp;
      else
        se[x] = max(se[x], tmp);
    }
  ins(1, 1, 1e6, T[x], -X[x]);
}
signed main() {
  int x;
  n = read(), t = read();
  for (int i = 1; i <= n; i++) X[i] = read();
  for (int i = 1; i <= n; i++) T[i] = read();
  for (int i = 2; i <= n; i++) x = read(), add(x, i, read());
  Dfs(1, t), cout << max(mx[1], val[1]);
  return 0;
}
