#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> stree[4 * 1000005];
void update(long long node, long long start, long long end, long long idx,
            long long freq) {
  if (start == end) {
    stree[node].first += freq;
    stree[node].second += (freq * idx);
  } else {
    long long mid = (start + end) / 2;
    if (start <= idx && idx <= mid)
      update(2 * node + 1, start, mid, idx, freq);
    else
      update(2 * node + 2, mid + 1, end, idx, freq);
    stree[node].first = (stree[2 * node + 1].first + stree[2 * node + 2].first);
    stree[node].second =
        (stree[2 * node + 1].second + stree[2 * node + 2].second);
  }
}
long long query(long long node, long long start, long long end, long long t) {
  long long mid = (start + end) / 2;
  if (start == end) {
    if (start == 0) return 0;
    long long cnt1 = stree[node].first;
    long long cnt2 = t / start;
    return min(cnt1, cnt2);
  }
  if (t <= stree[2 * node + 1].second)
    return query(2 * node + 1, start, mid, t);
  else {
    long long cnt = stree[2 * node + 1].first;
    cnt += query(2 * node + 2, mid + 1, end, t - stree[2 * node + 1].second);
    return cnt;
  }
}
long long n, T;
long long x[1000005], t[1000005], d[1000005], c[1000005];
vector<long long> adj[1000005];
void dfs(long long ver, long long time_left) {
  time_left -= 2 * d[ver];
  if (time_left <= 0) return;
  update(0, 0, 1000005 - 1, t[ver], x[ver]);
  c[ver] = query(0, 0, 1000005 - 1, time_left);
  for (long long i = 0; i < adj[ver].size(); i++) dfs(adj[ver][i], time_left);
  update(0, 0, 1000005 - 1, t[ver], -x[ver]);
}
long long dfs1(long long ver) {
  vector<long long> v;
  for (long long i = 0; i < adj[ver].size(); i++)
    v.push_back(dfs1(adj[ver][i]));
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  if (ver != 0) {
    if (v.size() == 0 || v.size() == 1)
      return c[ver];
    else
      return max(c[ver], v[1]);
  } else {
    if (v.size() == 0)
      return c[ver];
    else
      return max(c[ver], v[0]);
  }
}
long long solve() {
  cin >> n >> T;
  for (long long i = 0; i < n; i++) cin >> x[i];
  for (long long i = 0; i < n; i++) cin >> t[i];
  for (long long i = 1; i < n; i++) {
    long long p, dist;
    cin >> p >> dist;
    p--;
    adj[p].push_back(i);
    d[i] = dist;
  }
  dfs(0, T);
  cout << dfs1(0) << "\n";
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  long long t = 1;
  while (t-- != 0) {
    long long stat = solve();
  }
  return 0;
}
