#include <bits/stdc++.h>
using namespace std;
struct node {
  long long int tm, c;
  int l, r;
  void reset(int l = 0, int r = 0, long long int tm = 0LL,
             long long int c = 0LL) {
    this->tm = tm;
    this->c = c;
    this->l = l;
    this->r = r;
  }
};
long long int qtime;
vector<node> segTree(400011);
void merge(node &f, node j, node k) {
  f.reset(j.l, k.r, j.tm + k.tm, j.c + k.c);
}
void merge(int i) { merge(segTree[i], segTree[2 * i], segTree[2 * i + 1]); }
void build(int l, int r, int i = 1) {
  if (l == r) {
    segTree[i].reset(l, l, 0LL, 0LL);
    return;
  }
  int m = (l + r) / 2;
  build(l, m, 2 * i);
  build(m + 1, r, 2 * i + 1);
  merge(i);
}
void update_no(int l, long long int time, long long int c, int i = 1) {
  node &a = segTree[i];
  if (a.l == a.r && a.l == l) {
    a.tm = time;
    a.c = c;
    return;
  }
  int mid = (a.l + a.r) / 2;
  update_no(l, time, c, 2 * i + (l > mid));
  merge(i);
}
long long int query(int i = 1) {
  node &a = segTree[i];
  long long int tmpe = qtime;
  if (a.tm <= qtime) {
    qtime -= a.tm;
    return a.c;
  } else if (a.l == a.r) {
    long long int temp = (a.tm && a.c) ? qtime / (a.tm / a.c) : 0;
    qtime = 0;
    return temp;
  }
  return query(2 * i) + ((tmpe > segTree[2 * i].tm) ? query(2 * i + 1) : 0);
}
struct ed {
  int v, l;
};
vector<ed> graph[100001];
int c[100001], t[100001];
vector<pair<int, int>> wt;
int mp[100001];
long long int dfs(int u, long long int T) {
  long long int tmp1 = 0, tmp2 = 0, tmp, ans;
  update_no(mp[u], (1LL * t[u]) * c[u], 1LL * c[u]);
  qtime = T;
  ans = query();
  if (graph[u].size())
    for (auto v : graph[u]) {
      tmp = dfs(v.v, T - (2 * v.l));
      if (tmp > tmp1) {
        tmp2 = tmp1;
        tmp1 = tmp;
      } else if (tmp > tmp2)
        tmp2 = tmp;
    }
  update_no(mp[u], 0LL, 0LL);
  return max(ans, (u == 1) ? tmp1 : tmp2);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int i, n, p, l;
  long long int T;
  cin >> n >> T;
  for (i = 1; i <= n; i++) cin >> c[i];
  for (i = 1; i <= n; i++) {
    cin >> t[i];
    wt.push_back(make_pair(t[i], i));
  }
  build(1, n);
  sort(wt.begin(), wt.end());
  for (i = 0; i < n; i++) mp[wt[i].second] = i + 1;
  for (i = 2; i <= n; i++) {
    cin >> p >> l;
    graph[p].push_back({i, l});
  }
  cout << dfs(1, T) << endl;
}
