#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 1e5, V = (1 << 20);
int n, x[N_MAX], t[N_MAX];
struct edge {
  int l, v;
};
vector<edge> G[N_MAX];
long long cnt_tree[V + 1], total_tree[V + 1];
void add(int i, long long a, long long tree[]) {
  while (i <= V) {
    tree[i] += a;
    i += (i & -i);
  }
}
long long sum(int i, long long tree[]) {
  long long s = 0;
  while (i) {
    s += tree[i];
    i -= (i & -i);
  }
  return s;
}
int ind(long long a, long long tree[]) {
  int idx = 0, mask = V;
  a--;
  while (mask && idx < V) {
    int t = idx + mask;
    if (a >= tree[t]) {
      idx = t;
      a -= tree[t];
    }
    mask >>= 1;
  }
  return idx + 1;
}
long long T, sol[N_MAX];
void DFS(int v) {
  add(t[v], x[v], cnt_tree);
  add(t[v], (long long)x[v] * t[v], total_tree);
  int i = ind(T, total_tree);
  if (i > V)
    sol[v] = sum(V, cnt_tree);
  else
    sol[v] = sum(i - 1, cnt_tree) + (T - sum(i - 1, total_tree)) / i;
  long long m1 = -1, m2 = -1;
  for (edge e : G[v]) {
    if (T <= e.l) continue;
    T -= e.l;
    DFS(e.v);
    T += e.l;
    if (m1 < sol[e.v]) {
      m2 = m1;
      m1 = sol[e.v];
    } else if (m2 < sol[e.v])
      m2 = sol[e.v];
  }
  if (v == 0)
    sol[v] = max(sol[v], m1);
  else
    sol[v] = max(sol[v], m2);
  add(t[v], -x[v], cnt_tree);
  add(t[v], -(long long)x[v] * t[v], total_tree);
}
int main() {
  ios_base::sync_with_stdio(false);
  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 - 1; i++) {
    int p;
    edge e;
    cin >> p >> e.l;
    e.v = i;
    e.l *= 2;
    G[p - 1].push_back(e);
  }
  DFS(0);
  cout << sol[0] << endl;
  return 0;
}
