#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
const long long int Size = 2e6 + 1;
long long int factorial[Size];
long long int pow1(long long int x, long long int n, long long int m) {
  long long int result = 1;
  while (n > 0) {
    x %= m;
    if (n % 2 == 1) result = (result * x) % m;
    x = (x * x) % m;
    n = n / 2;
  }
  return result;
}
long long int pow2(long long int x, long long int n) {
  long long int result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x);
    x = (x * x);
    n = n / 2;
  }
  return result;
}
long long int modInverse(long long int A, long long int M) {
  return pow1(A, M - 2, M);
}
long long int n, T, X[Size], Time[Size], L[Size], f[Size], BIT[Size], co[Size],
    dp[Size];
vector<int> Adj[Size];
set<int> ti;
map<int, long long int> fre;
void update(long long int i, long long int val1, long long int val2) {
  for (; i < Size; i += i & (-i)) {
    BIT[i] += val1;
    co[i] += val2;
  }
}
long long int query1(long long int id) {
  long long int s = 0;
  for (; id > 0; id -= id & (-id)) s += BIT[id];
  return s;
}
long long int query2(long long int id) {
  long long int s = 0;
  for (; id > 0; id -= id & (-id)) s += co[id];
  return s;
}
long long int cal(long long int z) {
  long long int l = 0, r = *ti.rbegin();
  while (l < r) {
    int mid = (l + r + 1) / 2;
    long long int s = query1(mid);
    if (s <= z)
      l = mid;
    else
      r = mid - 1;
  }
  long long int s = query2(l);
  long long int rt = z - query1(l);
  if (l != *ti.rbegin()) {
    int up = *ti.upper_bound(l);
    s += rt / up;
  }
  return s;
}
void dfs1(int s, int p, long long int u) {
  if (2 * u > T) return;
  update(Time[s], X[s] * Time[s], X[s]);
  ti.insert(Time[s]);
  fre[Time[s]] += X[s];
  f[s] = cal(T - 2 * u);
  for (auto e : Adj[s]) {
    if (e == p) continue;
    dfs1(e, s, L[e] + u);
  }
  fre[Time[s]] -= X[s];
  if (fre[Time[s]] == 0) ti.erase(Time[s]);
  update(Time[s], -X[s] * Time[s], -X[s]);
}
void dfs2(int s, int p) {
  vector<long long int> v;
  v.push_back(0);
  v.push_back(0);
  for (auto e : Adj[s]) {
    if (e == p) continue;
    dfs2(e, s);
    v.push_back(dp[e]);
  }
  sort(v.begin(), v.end());
  if (s == 1)
    dp[s] = max(f[s], v[v.size() - 1]);
  else
    dp[s] = max(f[s], v[v.size() - 2]);
}
void solve() {
  cin >> n >> T;
  for (int i = int(0); i < int(n); i++) cin >> X[i + 1];
  for (int i = int(0); i < int(n); i++) cin >> Time[i + 1];
  for (int i = int(0); i < int(n - 1); i++) {
    int p, l;
    cin >> p >> l;
    Adj[p].push_back(i + 2);
    Adj[i + 2].push_back(p);
    L[i + 2] = l;
  }
  dfs1(1, -1, 0);
  dfs2(1, -1);
  cout << dp[1];
}
int main() {
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
