#include <bits/stdc++.h>
using namespace std;
void scan(int &n) {
  char c;
  while (c = getchar()) {
    if (c >= '0' && c <= '9') break;
  }
  n = c - '0';
  while (c = getchar()) {
    if (!(c >= '0' && c <= '9')) break;
    n = n * 10 + c - '0';
  }
}
void scan(long long &n) {
  char c;
  while (c = getchar()) {
    if (c >= '0' && c <= '9') break;
  }
  n = c - '0';
  while (c = getchar()) {
    if (!(c >= '0' && c <= '9')) break;
    n = n * 10 + c - '0';
  }
}
int ck[100005], tme[100005];
vector<pair<int, int> > edges[100005];
map<int, long long> mp;
long long best[100005];
long long tottme = 0, totck = 0;
void dfs(int u, long long t) {
  vector<pair<int, long long> > chge;
  mp[tme[u]] += ck[u];
  chge.push_back({tme[u], ck[u]});
  tottme += 1LL * tme[u] * ck[u];
  totck += ck[u];
  while (tottme > t) {
    auto c = *(--mp.end());
    long long cnt = (tottme - t) / c.first + ((tottme - t) % c.first > 0);
    if (cnt >= c.second) {
      mp.erase(c.first);
      chge.push_back({c.first, -c.second});
      tottme -= 1LL * c.first * c.second;
      totck -= c.second;
      continue;
    }
    mp[c.first] -= cnt;
    chge.push_back({c.first, -cnt});
    tottme -= 1LL * c.first * cnt;
    totck -= cnt;
  }
  best[u] = totck;
  for (auto v : edges[u]) {
    if (t >= v.second * 2) dfs(v.first, t - v.second * 2);
  }
  for (auto c : chge) {
    mp[c.first] -= c.second;
    tottme -= 1LL * c.first * c.second;
    totck -= c.second;
    if (!mp[c.first]) mp.erase(c.first);
  }
}
long long solve(int u) {
  long long mx = 0, smx = 0;
  for (auto v : edges[u]) {
    long long nv = solve(v.first);
    if (nv > mx)
      smx = mx, mx = nv;
    else if (nv > smx)
      smx = nv;
  }
  if (u == 1) return max(mx, best[u]);
  return max(smx, best[u]);
}
int main() {
  int n;
  long long t;
  scan(n);
  scan(t);
  for (int i = (1); i <= (n); i++) scan(ck[i]);
  for (int i = (1); i <= (n); i++) scan(tme[i]);
  for (int i = (2); i <= (n); i++) {
    int p, l;
    scan(p);
    scan(l);
    edges[p].push_back({i, l});
  }
  memset(best, 0, sizeof(best));
  dfs(1, t);
  printf("%lld\n", solve(1));
  return 0;
}
