#include <bits/stdc++.h>
using namespace std;
int n;
long long T, x[100001], t[100001], l[100001];
pair<long long, long long> bt[1 << 18];
vector<long long> v;
vector<int> child[100001];
int sz = 1;
void upd(int k, long long w, long long c) {
  while (k) {
    bt[k].first += w;
    bt[k].second += c;
    k >>= 1;
  }
}
long long qry(long long T) {
  int cur = 1;
  long long ret = 0;
  while (cur < sz) {
    if (bt[cur * 2].first > T)
      cur <<= 1;
    else {
      ret += bt[cur * 2].second;
      T -= bt[cur * 2].first;
      cur = (cur << 1) + 1;
    }
  }
  long long pt = (1LL << 60);
  if (cur - sz < v.size()) pt = v[cur - sz];
  return ret + min(T / pt, bt[cur].second);
}
long long res[100001];
void dfs(int u, long long dis) {
  if (dis * 2 >= T) return;
  int idx = lower_bound(v.begin(), v.end(), t[u]) - v.begin();
  upd(sz + idx, t[u] * x[u], x[u]);
  long long mx = qry(T - dis * 2), m2 = 0, m3 = 0;
  for (int i = 0; i < child[u].size(); i++) {
    int v = child[u][i];
    dfs(v, dis + l[v]);
    if (res[v] >= m2) {
      m3 = m2;
      m2 = res[v];
    } else if (res[v] > m3)
      m3 = res[v];
  }
  if (u == 1)
    res[u] = max(mx, m2);
  else
    res[u] = max(mx, m3);
  upd(sz + idx, -t[u] * x[u], -x[u]);
}
int main() {
  scanf("%d %lld", &n, &T);
  for (int i = 1; i <= n; i++) scanf("%lld", &x[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &t[i]);
    v.push_back(t[i]);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  while (sz < v.size()) sz *= 2;
  for (int i = 2; i <= n; i++) {
    int p;
    scanf("%d %lld", &p, &l[i]);
    child[p].push_back(i);
  }
  dfs(1, 0);
  long long ans = res[1];
  printf("%lld\n", ans);
  return 0;
}
