#include <bits/stdc++.h>
using namespace std;
const long long MX = 1e5 + 3, MXX = 1e6 + 3;
long long n, T, dp[MX], t[MX], p[MX], c[MX], x[MX], tsum[MXX], nd[4 * MXX],
    td[4 * MXX];
vector<pair<long long, long long> > vec[MX];
void add(long long id, long long st, long long en, long long pl, long long X);
long long bst(long long id, long long st, long long en, long long K);
void dfs(long long v, long long dis) {
  add(1, 0, MXX, t[v], x[v]);
  long long k = T - dis * 2;
  dp[v] = bst(1, 0, MXX, k);
  long long a = 0, b = 0;
  for (auto u : vec[v]) {
    dfs(u.first, dis + u.second);
    if (dp[u.first] >= a) {
      b = a;
      a = dp[u.first];
    } else if (dp[u.first] > b)
      b = dp[u.first];
  }
  if (v == 1)
    dp[v] = max(dp[v], a);
  else if (vec[v].size() > 1) {
    dp[v] = max(dp[v], b);
  }
  add(1, 0, MXX, t[v], -x[v]);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> T;
  for (long long i = 1; i < n + 1; i++) cin >> x[i];
  for (long long i = 1; i < n + 1; i++) cin >> t[i];
  for (long long i = 2; i < n + 1; i++) {
    cin >> p[i] >> c[i];
    vec[p[i]].push_back(make_pair(i, c[i]));
  }
  dfs(1, 0);
  cout << dp[1] << endl;
  return 0;
}
void add(long long id, long long st, long long en, long long pl, long long X) {
  if (st == en - 1) {
    td[id] += X;
    nd[id] += X * pl;
    return;
  }
  long long mid = (st + en) / 2;
  if (pl < mid)
    add(id * 2, st, mid, pl, X);
  else
    add(id * 2 + 1, mid, en, pl, X);
  td[id] += X;
  nd[id] += X * pl;
}
long long bst(long long id, long long st, long long en, long long K) {
  if (st == en - 1) return min(td[id], K / max(1ll, st));
  long long mid = (st + en) / 2, second = 0;
  if (nd[id * 2] <= K) {
    second += td[id * 2], K -= nd[id * 2];
    if (nd[id * 2 + 1] <= K)
      second += td[id * 2 + 1];
    else
      second += bst(id * 2 + 1, mid, en, K);
  } else
    second = bst(id * 2, st, mid, K);
  return second;
}
