#include <bits/stdc++.h>
using namespace std;
long long num_x[100005], time_y[100005];
void read(long long a[], long long n) {
  for (long long i = 1; i <= n; i++) cin >> a[i];
}
vector<pair<long long, long long> > tree[100005];
long long s_tree[100005 * 40], s_trees[100005 * 40];
void update(long long pos, long long l, long long r, long long x, long long t) {
  s_tree[pos] += t * x;
  s_trees[pos] += x;
  if (l == r) return;
  long long mid = (l + r) / 2;
  if (t <= mid)
    update(pos * 2, l, mid, x, t);
  else
    update(pos * 2 + 1, mid + 1, r, x, t);
}
long long query(long long pos, long long l, long long r, long long val) {
  if (l == r) return min(s_trees[pos], val / l);
  long long mid = (l + r) / 2;
  if (s_tree[pos * 2] <= val)
    return s_trees[pos * 2] +
           query(pos * 2 + 1, mid + 1, r, val - s_tree[pos * 2]);
  else
    return query(pos * 2, l, mid, val);
}
long long dfs(long long node, long long times) {
  update(1, 1, 1e6, num_x[node], time_y[node]);
  long long ans = query(1, 1, 1e6, times);
  long long son, t, f1 = 0, f2 = 0, num;
  for (long long i = 0; i < tree[node].size(); i++) {
    son = tree[node][i].first;
    t = tree[node][i].second;
    if (times < 2 * t) continue;
    num = dfs(son, times - 2 * t);
    if (num > f1) {
      f2 = f1;
      f1 = num;
    } else if (num > f2) {
      f2 = num;
    }
  }
  update(1, 1, 1e6, -num_x[node], time_y[node]);
  if (node == 1) return max(f1, ans);
  return max(f2, ans);
}
int main() {
  long long n, k;
  while (cin >> n >> k) {
    memset(num_x, 0, sizeof(num_x));
    memset(time_y, 0, sizeof(time_y));
    read(num_x, n);
    read(time_y, n);
    long long x, y;
    for (long long i = 2; i <= n; i++) {
      cin >> x >> y;
      tree[x].push_back(make_pair(i, y));
    }
    cout << dfs(1, k) << endl;
  }
}
