#include <bits/stdc++.h>
using namespace std;
int inf = 1e6;
const int N = 1e5 + 5;
int n;
long long T, sumT[N];
long long x[N], t[N], s[40 * N], total[40 * N];
struct Edge {
  int num;
  int next;
  long long c;
} edge[2 * N];
int tot, last[N];
long long val[N];
long long dp[N], f[N];
void Add(int i, int j) {
  tot++;
  edge[tot].num = j;
  edge[tot].next = last[i];
  last[i] = tot;
}
void Insert(int i, long long p, long long num, int l, int r) {
  s[i] += p * num;
  total[i] += num;
  if (p == l && p == r) return;
  int mid = (l + r) / 2;
  if (p <= mid) Insert(i * 2, p, num, l, mid);
  if (p >= mid + 1) Insert(i * 2 + 1, p, num, mid + 1, r);
}
long long Find(int i, long long limT, int l, int r) {
  if (l == r) return min(total[i], limT / l);
  int mid = (l + r) / 2;
  if (s[i * 2] <= limT)
    return Find(i * 2 + 1, limT - s[i * 2], mid + 1, r) + total[i * 2];
  else
    return Find(i * 2, limT, l, mid);
}
void dfs1(int u) {
  Insert(1, t[u], x[u], 1, inf);
  if (T - sumT[u] > 0) f[u] = Find(1, T - sumT[u], 1, inf);
  for (int k = last[u]; k != 0; k = edge[k].next) {
    int v = edge[k].num;
    sumT[v] = sumT[u] + 2 * val[v];
    dfs1(v);
  }
  Insert(1, t[u], -x[u], 1, inf);
}
void dfs2(int u) {
  int numm = 0;
  long long maxn1 = 0, maxn2 = 0;
  for (int k = last[u]; k != 0; k = edge[k].next) {
    int v = edge[k].num;
    numm++;
    dfs2(v);
    if (dp[v] > maxn1) {
      maxn2 = maxn1;
      maxn1 = dp[v];
    } else if (dp[v] > maxn2)
      maxn2 = dp[v];
  }
  if (u == 1) {
    dp[u] = max(maxn1, f[u]);
    return;
  }
  if (numm == 0 || numm == 1)
    dp[u] = f[u];
  else
    dp[u] = max(f[u], maxn2);
}
int main() {
  std::ios::sync_with_stdio(0);
  cin >> n >> T;
  long long l = 0, r = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x[i];
    r += x[i];
  }
  for (int i = 1; i <= n; i++) cin >> t[i];
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p >> val[i];
    Add(p, i);
  }
  dfs1(1);
  dfs2(1);
  cout << dp[1];
}
