#include <bits/stdc++.h>
using namespace std;
const long double pai = acos(-1.0L);
const long double eps = 1e-10;
const long long mod = 1e9 + 7;
const int MXN = 1e6 + 5;
long long n, tme, x[200005], t[200005], d[200005], can[200005], dp[MXN];
vector<int> g[MXN];
long long S[MXN * 4], C[MXN * 4], MXT = 1e6;
void update(int pos, int l, int r, int root, long long c) {
  if (l == r) {
    C[root] += c;
    S[root] += (c * (long long)l);
    return;
  }
  int mid = (l + r) / 2;
  if (pos <= mid)
    update(pos, l, mid, root << 1, c);
  else
    update(pos, mid + 1, r, root << 1 | 1, c);
  C[root] = C[root << 1] + C[root << 1 | 1];
  S[root] = S[root << 1] + S[root << 1 | 1];
}
long long query(int l, int r, int root, long long have) {
  if (l == r) {
    return min(have / (long long)l, C[root]);
  }
  int mid = (l + r) / 2;
  if (S[root << 1] > have) return query(l, mid, root << 1, have);
  return query(mid + 1, r, root << 1 | 1, have - S[root << 1]) + C[root << 1];
}
void dfs(int now, int pre, long long co) {
  update(t[now], 1, MXT, 1, x[now]);
  can[now] = query(1, MXT, 1, tme - co);
  for (auto i : g[now]) {
    if (i == pre) continue;
    dfs(i, now, co + d[i] * 2LL);
  }
  update(t[now], 1, MXT, 1, -x[now]);
}
void gao(int now, int pre) {
  if ((int)g[now].size() == 1) {
    dp[now] = can[now];
    return;
  }
  multiset<long long> st;
  for (auto i : g[now]) {
    if (i == pre) continue;
    gao(i, now);
    st.insert(dp[i]);
  }
  st.erase(--st.end());
  if ((int)st.size() != 0)
    dp[now] = max(can[now], *(--st.end()));
  else
    dp[now] = can[now];
}
int main() {
  cin >> n >> tme;
  for (int i = 1; i <= n; i++) {
    int sa;
    scanf("%d", &sa);
    x[i] = sa;
  }
  for (int i = 1; i <= n; i++) {
    int sa;
    scanf("%d", &sa);
    t[i] = sa;
  }
  for (int i = 2; i <= n; i++) {
    int sa;
    scanf("%d", &sa);
    g[sa].push_back(i);
    g[i].push_back(sa);
    int sb;
    scanf("%d", &sb);
    d[i] = sb;
  }
  dfs(1, -1, 0);
  long long ans = min(tme / t[1], x[1]);
  for (auto i : g[1]) {
    gao(i, 1);
    ans = max(ans, dp[i]);
  }
  cout << ans << '\n';
  return 0;
}
