#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int TIME = 1e6 + 7, N = 1e5 + 7;
long long st[3 * TIME], fenv[TIME];
pair<long long, int> get(int v, int l, int r, long long trg) {
  if (l == r) {
    if (st[v] >= trg || (trg == -1 && st[v])) {
      return {0, l};
    }
    return {-1, -1};
  }
  int half = (l + r) >> 1;
  if (trg == -1) {
    if (st[2 * v]) {
      return get(2 * v, l, half, trg);
    }
    if (st[2 * v + 1]) {
      return get(2 * v + 1, half + 1, r, trg);
    }
    return {-1, -1};
  }
  if (st[2 * v] >= trg) {
    auto q = get(2 * v, l, half, trg);
    if (q.second == -1) {
      auto lol = get(2 * v + 1, half + 1, r, -1);
      return {st[2 * v] + lol.first, lol.second};
    }
    return q;
  }
  auto lol = get(2 * v + 1, half + 1, r, trg - st[2 * v]);
  return {st[2 * v] + lol.first, lol.second};
}
void add(int v, int l, int r, int trg, long long cnt) {
  if (trg < l || trg > r) {
    return;
  }
  if (l == r) {
    st[v] += cnt * trg;
    return;
  }
  int half = (l + r) >> 1;
  add(2 * v, l, half, trg, cnt);
  add(2 * v + 1, half + 1, r, trg, cnt);
  st[v] = st[2 * v] + st[2 * v + 1];
}
int LOL = 1e6;
void add(int v, long long value) {
  for (; v <= LOL; v |= v + 1) {
    fenv[v] += value;
  }
}
long long get(int v) {
  long long res = 0;
  for (; v >= 0; v = (v & (v + 1)) - 1) {
    res += fenv[v];
  }
  return res;
}
int n, L[N], x[N], t[N];
long long T;
vector<int> graph[N];
long long dfs(int v, long long act) {
  act += 2 * L[v];
  add(1, 1, LOL, t[v], x[v]);
  add(t[v], x[v]);
  auto q = get(1, 1, LOL, T - act);
  long long W;
  if (q.second == -1) {
    W = get(LOL);
  } else {
    W = get(q.second - 1) + (T - act - q.first) / q.second;
  }
  long long mx = -1, prMax = -1;
  for (auto i : graph[v]) {
    long long q = dfs(i, act);
    if (q > mx) {
      prMax = mx;
      mx = q;
    } else if (q > prMax) {
      prMax = q;
    }
  }
  add(1, 1, LOL, t[v], -x[v]);
  add(t[v], -x[v]);
  if (v == 0) {
    return max({prMax, mx, W});
  }
  if (prMax == -1) {
    return W;
  }
  return max(prMax, W);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> T;
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
  }
  int v;
  for (int i = 1; i < n; ++i) {
    cin >> v >> L[i];
    v--;
    graph[v].push_back(i);
  }
  cout << dfs(0, 0);
  return 0;
}
