#include <bits/stdc++.h>
using namespace std;
long long N, X[100001], T[100001];
long long TIME;
vector<pair<long long, long long>> adj[100001];
long long tree[2][1000003];
long long cookies[100001];
long long best[100001];
long long sum(long long mode, long long x) {
  long long s = 0;
  while (x >= 1) {
    s += tree[mode][x];
    x -= (x & -x);
  }
  return s;
}
void update(long long mode, long long x, long long k) {
  while (x <= 1000001) {
    tree[mode][x] += k;
    x += (x & -x);
  }
}
void dfs(long long node, long long cur) {
  update(0, T[node], X[node]);
  update(1, T[node], X[node] * T[node]);
  long long low = -1, high = 1000001, mid;
  while (low + 1 < high) {
    mid = (low + high) / 2;
    if (sum(1, mid) >= TIME - cur * 2)
      high = mid;
    else
      low = mid;
  }
  if (high == 0) {
    cookies[node] = 0;
  } else
    cookies[node] =
        sum(0, high) -
        max(0LL, (sum(1, high) - (TIME - cur * 2) + high - 1) / high);
  for (int i = 0; i < adj[node].size(); i++)
    dfs(adj[node][i].first, cur + adj[node][i].second);
  if (adj[node].size() <= 1)
    best[node] = cookies[node];
  else {
    vector<long long> v;
    for (int i = 0; i < adj[node].size(); i++)
      v.push_back(best[adj[node][i].first]);
    sort(v.begin(), v.end());
    best[node] = max(cookies[node], v[v.size() - 2]);
  }
  update(0, T[node], -X[node]);
  update(1, T[node], -X[node] * T[node]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> TIME;
  for (int i = 1; i <= N; i++) cin >> X[i];
  for (int i = 1; i <= N; i++) cin >> T[i];
  for (int i = 2; i <= N; i++) {
    int X, Y;
    cin >> X >> Y;
    adj[X].push_back({i, Y});
  }
  dfs(1, 0);
  long long ans = best[1];
  for (int i = 0; i < adj[1].size(); i++) ans = max(ans, best[adj[1][i].first]);
  cout << ans << '\n';
  return 0;
}
