#include <bits/stdc++.h>
using namespace std;
long long int Pow(long long int a, long long int b, long long int md,
                  long long int ans = 1) {
  for (; b; b >>= 1, a = a * a % md)
    if (b & 1) ans = ans * a % md;
  return ans % md;
}
const long long int MAXN = 1e6 + 10;
const long long int INF = 8e18;
const long long int MOD = 1e9 + 7;
long long int wot[MAXN], fen[MAXN], dp[MAXN], mx[MAXN], L[MAXN], T[MAXN],
    X[MAXN], E, n;
vector<long long int> adj[MAXN];
void update(long long int pos, long long int val) {
  for (; pos < MAXN; pos += pos & -pos) {
    fen[pos] += val;
  }
}
void modify(long long int pos, long long int val) {
  for (; pos < MAXN; pos += pos & -pos) {
    wot[pos] += val;
  }
}
long long int getwot(long long int pos, long long int res = 0) {
  for (; pos; pos -= pos & -pos) {
    res += wot[pos];
  }
  return res;
}
long long int get(long long int pos, long long int res = 0) {
  for (; pos; pos -= pos & -pos) {
    res += fen[pos];
  }
  return res;
}
long long int Find(long long int val) {
  long long int id = 0, sum = 0;
  for (long long int i = 19; i >= 0; i--) {
    id += 1LL << i;
    if (id < MAXN && sum + fen[id] <= val)
      sum += fen[id];
    else
      id -= 1LL << i;
  }
  return id;
}
void DFS(long long int v, long long int sum = 0) {
  if (sum * 2 > E) return;
  modify(T[v], X[v]);
  update(T[v], X[v] * T[v]);
  long long int x = Find(E - sum - sum);
  dp[v] += getwot(x);
  if (x + 1 < MAXN) {
    dp[v] += min(getwot(x + 1) - getwot(x), (E - sum - sum - get(x)) / (x + 1));
  }
  mx[v] = dp[v];
  for (long long int u : adj[v]) {
    DFS(u, sum + L[u]);
  }
  modify(T[v], -X[v]);
  update(T[v], -T[v] * X[v]);
}
void DFSCalc(long long int v) {
  set<pair<long long int, long long int>,
      greater<pair<long long int, long long int>>>
      st;
  for (long long int u : adj[v]) {
    DFSCalc(u);
    st.insert({mx[u], u});
  }
  if (v == 1) {
    mx[v] = max(mx[v], st.begin()->first);
    return;
  }
  if ((long long int)st.size()) st.erase(st.begin());
  if ((long long int)st.size()) mx[v] = max(mx[v], st.begin()->first);
}
int main() {
  scanf("%lld%lld", &n, &E);
  for (long long int i = 1; i <= n; i++) {
    scanf("%lld", &X[i]);
  }
  for (long long int i = 1; i <= n; i++) {
    scanf("%lld", &T[i]);
  }
  for (long long int i = 2; i <= n; i++) {
    long long int p;
    scanf("%lld%lld", &p, &L[i]);
    adj[p].push_back(i);
  }
  DFS(1);
  DFSCalc(1);
  printf("%lld\n", mx[1]);
  return 0;
}
