#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long int n, m, k, res = 0, ans = 0, sm = 0, edge = -1, T;
long long int a[500005], t[500005], dpt[500002] = {0}, bitt[2000005] = {0},
                                    bitx[2000005] = {0}, vis[500005] = {0},
                                    dp[500005], memo[500005][3];
vector<long long int> fact[500005];
set<pair<int, int> > st, st1, st2;
set<long long int> stres;
string s, s1, s2, s3, s4;
vector<long long int> v[500005], vnode, vans, v3;
vector<pair<int, int> > vv, vv1, adj[500005], v1, v2;
vector<pair<int, pair<int, int> > > vvv;
priority_queue<long long int> q;
map<pair<long long int, long long int>, long long int> mp;
set<pair<int, int> >::iterator it, it1, it2;
int voyel(char c) {
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y')
    return 1;
  return 0;
}
vector<pair<char, char> > vvc;
void dfs1(long long int x, long long int p) {
  vis[x] = 1;
  if (p != -1) dpt[x] = dpt[p] + mp[{x, p}];
  for (long long int y : v[x])
    if (!vis[y]) dfs1(y, x);
}
void updatet(long long int x, long long int val) {
  for (; x <= 1000005; x += x & -x) bitt[x] += val;
}
long long int queryt(long long int x) {
  long long int sum = 0;
  for (; x > 0; x -= x & -x) {
    sum += bitt[x];
  }
  return sum;
}
void updatex(long long int x, long long int val) {
  for (; x <= 1000005; x += x & -x) bitx[x] += val;
}
long long int queryx(long long int x) {
  long long int sum = 0;
  for (; x > 0; x -= x & -x) {
    sum += bitx[x];
  }
  return sum;
}
long long int f(long long int idx, long long int tt) {
  long long int sm = queryt(idx);
  if (sm < tt)
    return 0;
  else
    return 1;
}
void dfs2(long long int x) {
  vis[x] = 1;
  long long int nbx = a[x];
  long long int tx = t[x];
  long long int prod = nbx * tx;
  updatet(tx, prod);
  updatex(tx, nbx);
  long long int idx1 = -1;
  for (long long int z = 1000000; z >= 1; z /= 2) {
    while (idx1 + z <= 1000005 && !f(idx1 + z, T - dpt[x])) idx1 += z;
  }
  long long int idx2 = idx1 + 1;
  long long int nbxt = queryx(idx1);
  long long int trest = T - dpt[x] - queryt(idx1);
  if (queryt(idx2) > queryt(idx1)) nbxt += (trest / idx2);
  dp[x] = nbxt;
  for (long long int y : v[x])
    if (!vis[y]) dfs2(y);
  updatet(tx, -prod);
  updatex(tx, -nbx);
}
long long int dfs(long long int x, long long int p, long long int flag) {
  vis[x] = 1;
  long long int &ret = memo[x][flag];
  if (ret != -1) return ret;
  if (!flag) {
    long long int mm = 0;
    for (long long int y : v[x]) {
      if (!vis[y]) mm = max(mm, dfs(y, x, 1));
    }
    return ret = max(mm, dp[x]);
  } else {
    long long int mm = 0, maxson = x;
    for (long long int y : v[x]) {
      if (!vis[y]) {
        if (mm <= dfs(y, x, 1)) {
          mm = dfs(y, x, 1);
          maxson = y;
        }
      }
    }
    mm = dp[x];
    for (long long int y : v[x]) {
      if (y != p && y != maxson) mm = max(mm, dfs(y, x, 1));
    }
    return ret = max(mm, dp[x]);
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long int i = 0, j = 0, x, y, z = 0, mx = 0, nb0 = 0, nb = 0, nbmax = 0,
                nbinf = 0, mm = 5e9, idx = 0, ok = 0, l, r, negatif = 0,
                positif = 0, q, d;
  char c;
  cin >> n >> T;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) cin >> t[i];
  for (i = 2; i <= n; i++) {
    cin >> x >> y;
    v[x].push_back(i);
    v[i].push_back(x);
    mp[{i, x}] = mp[{x, i}] = y;
  }
  memset(dpt, 0, sizeof(dpt));
  memset(dp, 0, sizeof(dp));
  dfs1(1, -1);
  for (i = 1; i <= n; i++) dpt[i] *= 2;
  memset(vis, 0, sizeof(vis));
  dfs2(1);
  memset(vis, 0, sizeof(vis));
  memset(memo, -1, sizeof(memo));
  res = dfs(1, -1, 0);
  cout << res;
  return 0;
}
