#include <bits/stdc++.h>
const long long MAX_N = 1e6 + 10;
const long long MOD = 1e9 + 7;
using namespace std;
long long cnt[MAX_N];
long long a[MAX_N];
long long b[MAX_N];
long long l[MAX_N];
int p[MAX_N];
long long fen[MAX_N][2];
long long ans[MAX_N];
long long dp[MAX_N];
long long sm[MAX_N];
long long T;
vector<int> g[MAX_N];
int n;
void add(int x, long long m, int d) {
  for (; x < MAX_N; x += (x & -x)) fen[x][d] += m;
}
long long gt(int x, int d) {
  long long ans = 0;
  for (; x; x -= (x & -x)) ans += fen[x][d];
  return ans;
}
void fd(int v) {
  sm[v] = sm[p[v]] + 2 * l[v];
  for (auto u : g[v]) fd(u);
}
void sfd(int v) {
  cnt[b[v]] += a[v];
  add(b[v], a[v], 0);
  add(b[v], a[v] * b[v], 1);
  for (auto x : g[v]) sfd(x);
  if (T >= sm[v]) {
    T -= sm[v];
    int l = 0;
    int r = MAX_N - 2;
    while (r - l > 1) {
      int mid = (l + r) / 2;
      if (gt(mid, 1) <= T)
        l = mid;
      else
        r = mid;
    }
    ans[v] = gt(l, 0);
    ans[v] += min(cnt[l + 1], (T - gt(l, 1)) / (l + 1));
    T += sm[v];
  }
  cnt[b[v]] -= a[v];
  add(b[v], -(a[v]), 0);
  add(b[v], -(a[v] * b[v]), 1);
}
void dfs(int v) {
  for (auto u : g[v]) dfs(u);
  vector<long long> vc;
  dp[v] = ans[v];
  for (auto u : g[v]) vc.push_back(dp[u]);
  sort(vc.begin(), vc.end());
  if (v == 1) {
    dp[v] = max(dp[v], vc[vc.size() - 1]);
    return;
  }
  if (vc.size() > 1) dp[v] = max(dp[v], vc[vc.size() - 2]);
}
int main() {
  cin >> n >> T;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) cin >> b[i];
  for (int i = 2; i <= n; ++i) {
    cin >> p[i] >> l[i];
    g[p[i]].push_back(i);
  }
  fd(1);
  sfd(1);
  dfs(1);
  cout << dp[1];
  return 0;
}
