#include <bits/stdc++.h>
using namespace std;
void Freopen() {
  freopen(
      "title"
      ".in",
      "r", stdin);
  freopen(
      "title"
      ".out",
      "w", stdout);
}
long long read() {
  long long g = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    g = g * 10 + ch - '0';
    ch = getchar();
  }
  return g * f;
}
const int N = 1e5 + 5;
const int M = 1e6 + 5;
const int maxn = 1e6;
long long ans[N], re[N], T;
int n, nu[N], vl[N], ew[N];
vector<int> G[N];
struct Seg {
  long long su[M << 2], sut[M << 2];
  void up(int v) {
    su[v] = su[v << 1] + su[v << 1 | 1];
    sut[v] = sut[v << 1] + sut[v << 1 | 1];
  }
  void insert(int v, int l, int r, int q, int x) {
    if (l == r) return su[v] += x, sut[v] += 1ll * x * l, void();
    int mid = l + r >> 1;
    if (q <= mid)
      insert(v << 1, l, mid, q, x);
    else
      insert(v << 1 | 1, mid + 1, r, q, x);
    up(v);
  }
  long long get(int v, int l, int r, long long nd) {
    if (l == r) return min(su[v], nd / l);
    int mid = l + r >> 1;
    if (nd > sut[v << 1])
      return su[v << 1] + get(v << 1 | 1, mid + 1, r, nd - sut[v << 1]);
    else
      return get(v << 1, l, mid, nd);
  }
} seg;
void dfs(int x, long long dep) {
  if (T > 2 * dep) ans[x] = re[x] = seg.get(1, 1, maxn, T - 2 * dep);
  long long mx1 = 0, mx2 = 0;
  for (auto y : G[x]) {
    seg.insert(1, 1, maxn, vl[y], nu[y]);
    dfs(y, dep + ew[y]);
    if (re[y] > mx1)
      mx2 = mx1, mx1 = re[y];
    else if (re[y] > mx2)
      mx2 = re[y];
    seg.insert(1, 1, maxn, vl[y], -nu[y]);
  }
  if (x ^ 1)
    re[x] = max(re[x], mx2);
  else
    re[x] = max(re[x], mx1);
}
signed main() {
  n = read(), T = read();
  for (int i = (1); i <= (n); i++) nu[i] = read();
  for (int i = (1); i <= (n); i++) vl[i] = read();
  for (int i = (2); i <= (n); i++) {
    int x = read();
    G[x].push_back(i);
    ew[i] = read();
  }
  seg.insert(1, 1, maxn, vl[1], nu[1]);
  dfs(1, 0);
  return cout << re[1], signed();
}
