#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int x[maxn], t[maxn];
int p[maxn], l[maxn];
long long tot[maxn], con[maxn];
int ut[maxn], e;
vector<int> g[maxn];
struct BIT {
  int n;
  vector<long long> bit;
  BIT() {}
  BIT(int _n) {
    n = _n;
    bit.resize(n);
  }
  void alloc(int _n) {
    n = _n;
    bit.resize(n, 0);
  }
  int lowbit(int x) { return x & -x; }
  void update(int x, long long val) {
    while (x <= n) {
      bit[x] += val;
      x += lowbit(x);
    }
  }
  long long ask(int x) {
    long long res = 0;
    while (x) {
      res += bit[x];
      x -= lowbit(x);
    }
    return res;
  }
} num, val;
int pos(int x) { return lower_bound(ut + 1, ut + 1 + e, x) - ut; }
long long getans(long long T) {
  int l = 1, r = e;
  while (r > l) {
    int mid = (l + r) >> 1;
    if (val.ask(mid) <= T)
      l = mid + 1;
    else
      r = mid;
  }
  long long res = num.ask(l - 1);
  T -= val.ask(l - 1);
  res += min(tot[l], T / ut[l]);
  return res;
}
void dfs(int o, long long T) {
  int p = pos(t[o]);
  num.update(p, x[o]);
  val.update(p, 1ll * x[o] * t[o]);
  tot[p] += x[o];
  con[o] = getans(T);
  for (auto& u : g[o]) {
    dfs(u, T - 2ll * l[u]);
  }
  num.update(p, -x[o]);
  val.update(p, -1ll * x[o] * t[o]);
  tot[p] -= x[o];
}
long long game(int o) {
  long long mx = 0, smx = 0;
  for (auto& u : g[o]) {
    long long temp = game(u);
    if (temp > mx) {
      smx = mx;
      mx = temp;
    } else {
      if (temp > smx) smx = temp;
    }
  }
  return max(con[o], smx);
}
int main() {
  int n;
  long long T;
  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]);
    ut[i] = t[i];
  }
  sort(ut + 1, ut + 1 + n);
  e = unique(ut + 1, ut + 1 + n) - (ut + 1);
  val.alloc(e + 1);
  num.alloc(e + 1);
  for (int i = 2; i <= n; i++) {
    scanf("%d%d", &p[i], &l[i]);
    g[p[i]].push_back(i);
  }
  dfs(1, T);
  long long ans = con[1];
  for (auto& u : g[1]) {
    ans = max(ans, game(u));
  }
  printf("%lld\n", ans);
  return 0;
}
