#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, M = 1e6 + 10;
vector<int> adj[N];
int n, x[N], t[N], l[N];
long long T, w[N], dp[N], mx[N], nxt_mx[N], fen[M][2];
void add(int p, int x) {
  int k = p;
  for (p++; p < M; p += p & -p) fen[p][0] += x, fen[p][1] += 1LL * k * x;
}
long long get(int p, int id) {
  long long res = 0;
  for (p++; p; p -= p & -p) res += fen[p][id];
  return res;
}
void dfs(int u) {
  add(t[u], x[u]);
  int L = 0, R = M - 2;
  while (R - L > 1) {
    int mid = (L + R) >> 1;
    (get(mid, 1) + 2 * w[u] <= T ? L : R) = mid;
  }
  dp[u] = get(L, 0) + min((T - get(L, 1) - 2 * w[u]) / (L + 1),
                          (get(L + 1, 0) - get(L, 0)));
  for (auto v : adj[u]) {
    w[v] = w[u] + l[v];
    dfs(v);
    (dp[v] >= mx[u] ? nxt_mx[u] = mx[u],
     mx[u] = dp[v]  : (dp[v] > nxt_mx[u] ? nxt_mx[u] = dp[v] : 0));
  }
  dp[u] = max(nxt_mx[u], dp[u]);
  if (!u) dp[u] = max(dp[u], mx[u]);
  add(t[u], -x[u]);
}
void input() {
  cin >> n >> T;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < n; i++) cin >> t[i];
  for (int i = 1; i < n; i++) {
    int u;
    cin >> u >> l[i];
    adj[--u].push_back(i);
  }
}
void solve() { dfs(0); }
void output() { cout << dp[0] << endl; }
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  input(), solve(), output();
  return 0;
}
