#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFLL = 1e18;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 5;
complex<long long> BIT[MAXN];
complex<long long> sumBIT(int p) {
  complex<long long> ret = {0, 0};
  for (; p > 0; p -= (p & -p)) ret += BIT[p];
  return ret;
}
void updBIT(int p, complex<long long> val) {
  for (; p < MAXN; p += (p & -p)) BIT[p] += val;
}
long long findBIT(long long T) {
  int b = 1 << 20;
  int mask = 0;
  complex<long long> ret = {0, 0};
  while (b > 0) {
    mask ^= b;
    if (mask >= MAXN || (ret + BIT[mask]).real() > T)
      mask ^= b;
    else
      ret += BIT[mask];
    b >>= 1;
  }
  if (mask < MAXN - 1) {
    complex<long long> aux = {0, (T - ret.real()) / (mask + 1)};
    ret += aux;
  }
  return ret.imag();
}
vector<int> G[MAXN];
long long l[MAXN], X[MAXN], t[MAXN];
long long cookies[MAXN];
long long dp[MAXN];
void dfs(int v, long long T) {
  updBIT(t[v], {X[v] * t[v], X[v]});
  cookies[v] = findBIT(T);
  for (auto u : G[v]) dfs(u, T - 2 * l[u]);
  updBIT(t[v], {-X[v] * t[v], -X[v]});
}
long long solve(int v) {
  if (dp[v] != -1) return dp[v];
  long long mx1 = 0, mx2 = 0;
  for (auto u : G[v]) {
    long long aux = solve(u);
    if (aux > mx1)
      mx2 = mx1, mx1 = aux;
    else if (aux > mx2)
      mx2 = aux;
  }
  if (v == 0) return dp[v] = max(mx1, cookies[v]);
  return dp[v] = max(mx2, cookies[v]);
}
int main() {
  int n;
  long long T;
  memset(BIT, 0, sizeof(BIT));
  memset(dp, -1, sizeof(dp));
  scanf("%d", &n);
  scanf("%lld", &T);
  for (int i = 0; i < n; i++) scanf("%lld", &X[i]);
  for (int i = 0; i < n; i++) scanf("%lld", &t[i]);
  for (int i = 1; i < n; i++) {
    int p;
    scanf("%d", &p);
    p--;
    G[p].push_back(i);
    scanf("%lld", &l[i]);
  }
  dfs(0, T);
  printf("%lld\n", solve(0));
  return 0;
}
