#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MXN = 100005;
const int OFF = 1 << 17;
ll T, l[MXN], cnt[2 * OFF], cst[2 * OFF];
int x[MXN], p[MXN], t[MXN], id[MXN], rev[MXN], n;
vector<int> adj[MXN];
void upd(int nd, int v, ll sgn) {
  nd += OFF;
  cnt[nd] += sgn * x[v];
  cst[nd] += sgn * x[v] * t[v];
  while (nd /= 2) {
    cnt[nd] = cnt[2 * nd] + cnt[2 * nd + 1];
    cst[nd] = cst[2 * nd] + cst[2 * nd + 1];
  }
}
ll get(int x, ll T) {
  if (x >= OFF) return cnt[x] ? min(T / (cst[x] / cnt[x]), cnt[x]) : 0;
  if (cst[2 * x] > T) return get(2 * x, T);
  return cnt[2 * x] + get(2 * x + 1, T - cst[2 * x]);
}
ll dfs(int x) {
  upd(rev[x], x, +1);
  ll mx1 = 0, mx2 = 0;
  for (int y : adj[x]) {
    ll res = dfs(y);
    if (res > mx1) {
      mx2 = mx1, mx1 = res;
    } else if (res > mx2) {
      mx2 = res;
    }
  }
  ll res = get(1, max(T - 2 * l[x], 0LL));
  upd(rev[x], x, -1);
  return max(res, x == 1 ? mx1 : mx2);
}
int main() {
  scanf("%d%lld", &n, &T);
  for (int i = 1; i <= n; ++i) scanf("%d", x + i);
  for (int i = 1; i <= n; ++i) scanf("%d", t + i);
  for (int i = 2; i <= n; ++i) {
    scanf("%d%lld", p + i, l + i);
    l[i] += l[p[i]];
    adj[p[i]].push_back(i);
  }
  iota(id, id + n + 1, 0);
  sort(id, id + n + 1, [](int a, int b) { return t[a] < t[b]; });
  for (int i = 0; i <= n; ++i) rev[id[i]] = i;
  printf("%lld\n", dfs(1));
}
