#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 6;
int baj(int a, int b) {
  if (a % b) return a / b + 1;
  return a / b;
}
int n;
long long t, x[N], l[N], rt[N], dp[N], sg[4 * N], ck[4 * N];
pair<int, int> tim[N];
long long ans = 0;
vector<int> g[N];
void update(int v, int tl, int tr, int ind, long long del, long long pech) {
  if (tl == ind && tr == ind) {
    sg[v] += del;
    ck[v] += pech;
    return;
  }
  int tm = (tl + tr) / 2;
  if (ind <= tm)
    update(v + v, tl, tm, ind, del, pech);
  else
    update(v + v + 1, tm + 1, tr, ind, del, pech);
  sg[v] = sg[v + v] + sg[v + v + 1];
  ck[v] = ck[v + v] + ck[v + v + 1];
}
long long query(int v, int tl, int tr, long long bn) {
  if (tl == tr) {
    if (sg[v] == 0 || ck[v] == 0) return 0;
    return min(ck[v], bn / (sg[v] / ck[v]));
  }
  int tm = (tl + tr) / 2;
  if (sg[v + v] >= bn)
    return query(v + v, tl, tm, bn);
  else
    return ck[v + v] + query(v + v + 1, tm + 1, tr, bn - sg[v + v]);
}
int ind[N];
void dfs(int v) {
  ans += l[v];
  update(1, 0, n - 1, ind[v], x[v] * rt[v], x[v]);
  dp[v] = query(1, 0, n - 1, t - 2 * ans);
  long long mx1 = 0, mx2 = 0;
  for (auto to : g[v]) {
    dfs(to);
    if (dp[to] > mx1) {
      mx2 = mx1;
      mx1 = dp[to];
    } else if (dp[to] > mx2) {
      mx2 = dp[to];
    }
  }
  if (v != 1)
    dp[v] = max(dp[v], mx2);
  else
    dp[v] = max(dp[v], mx1);
  update(1, 0, n - 1, ind[v], -x[v] * rt[v], -x[v]);
  ans -= l[v];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> t;
  for (int i = (1); i <= (n); ++i) cin >> x[i];
  for (int i = (1); i <= (n); ++i) {
    cin >> tim[i - 1].first;
    rt[i] = tim[i - 1].first;
    tim[i - 1].second = i;
  }
  for (int i = (2); i <= (n); ++i) {
    int p;
    cin >> p >> l[i];
    g[p].push_back(i);
  }
  sort(tim, tim + n);
  for (int i = 0; i < (n); ++i) {
    ind[tim[i].second] = i;
  }
  dfs(1);
  cout << dp[1] << endl;
  return 0;
}
