#include <bits/stdc++.h>
using namespace std;
int const MAXN = 2e6 + 9;
long long n, tim;
long long x[MAXN], t[MAXN], dp[MAXN];
vector<pair<int, long long>> g[MAXN];
struct BIT {
  vector<long long> bit;
  int n;
  BIT(int n) {
    this->n = n;
    bit.assign(n, 0);
  }
  long long sum(int r) {
    long long ret = 0;
    for (; r >= 0; r = (r & (r + 1)) - 1) ret += bit[r];
    return ret;
  }
  long long sum(int l, int r) { return sum(r) - sum(l - 1); }
  void add(int idx, long long delta) {
    for (; idx < n; idx = idx | (idx + 1)) bit[idx] += delta;
  }
};
BIT tree(MAXN), tree_x(MAXN);
long long get(long long x) {
  long long low = 0, hi = MAXN - 10;
  long long ret = 0;
  long long have = 0;
  while (low <= hi) {
    long long mid = (low + hi + 1) / 2;
    long long sum = tree.sum(mid);
    if (sum <= x) {
      ret = mid;
      have = x - sum;
      low = mid + 1;
    } else
      hi = mid - 1;
  }
  long long ans = tree_x.sum(ret);
  if (ret + 1 <= 1e6) ans += have / (ret + 1);
  return ans;
}
void dfs(int node, long long d) {
  if (d > tim) return;
  tree.add(t[node], t[node] * x[node]);
  tree_x.add(t[node], x[node]);
  long long mx1 = 0, mx2 = 0;
  for (auto u : g[node]) {
    long long w = u.second;
    int child = u.first;
    dfs(child, d + 2LL * w);
    if (dp[child] > mx1)
      mx2 = mx1, mx1 = dp[child];
    else if (dp[child] > mx2)
      mx2 = dp[child];
  }
  if (node == 1)
    dp[node] = max(mx1, get(tim - d));
  else
    dp[node] = max(mx2, get(tim - d));
  tree.add(t[node], -t[node] * x[node]);
  tree_x.add(t[node], -x[node]);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> tim;
  for (int i = 1; i <= n; i++) cin >> x[i];
  for (int i = 1; i <= n; i++) cin >> t[i];
  for (int i = 2; i <= n; i++) {
    int p, w;
    cin >> p >> w;
    g[p].emplace_back(i, w);
  }
  dfs(1, 0);
  cout << dp[1] << '\n';
}
