#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n;
long long T;
int t[N];
int x[N];
long long dp[N];
int ans;
map<int, int> id;
vector<pair<int, int>> adj[N], here;
struct fenwick {
  vector<long long> fenw;
  fenwick() { fenw.resize(N, 0); }
  void update(int i, long long val, int ty) {
    for (; i < fenw.size(); i += i & (-i)) {
      fenw[i] += val * ty;
    }
  }
  long long query(int i) {
    long long ans = 0;
    for (; i > 0; i -= i & (-i)) {
      ans += fenw[i];
    }
    return ans;
  }
  long long query(int x, int y) {
    if (x > y) return 0;
    return (query(y) - (x > 0 ? query(x - 1) : 0));
  }
};
fenwick cnt, foo;
long long counter(int u, long long cost) {
  if (foo.query(1, N - 1) <= cost) {
    return cnt.query(1, N - 1);
  }
  int l = 1, r = n;
  while (l != r) {
    int mid = (l + r) >> 1;
    if (foo.query(1, mid) > cost) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  long long ans = cnt.query(1, l - 1);
  cost -= foo.query(1, l - 1);
  ans += cost / here[l - 1].first;
  return ans;
}
void dfs(int u, long long cost) {
  cnt.update(id[u], x[u], 1);
  foo.update(id[u], 1ll * x[u] * t[u], 1);
  for (auto v : adj[u]) {
    dfs(v.first, cost + v.second * 2ll);
  }
  if (adj[u].empty()) {
    dp[u] = counter(u, T - cost);
  } else {
    long long ma1 = 0, ma2 = 0;
    for (auto v : adj[u]) {
      if (dp[v.first] >= ma1) {
        ma2 = ma1;
        ma1 = dp[v.first];
      } else if (dp[v.first] > ma2) {
        ma2 = dp[v.first];
      }
    }
    if (u == 1) {
      dp[u] = max(counter(u, T - cost), ma1);
    } else {
      dp[u] = max(counter(u, T - cost), ma2);
    }
  }
  cnt.update(id[u], x[u], -1);
  foo.update(id[u], 1ll * x[u] * t[u], -1);
}
int main() {
  cin >> n >> T;
  for (int i = 1; i <= n; i++) cin >> x[i];
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
    here.push_back({t[i], i});
  }
  for (int i = 2; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back({i, y});
  }
  sort(here.begin(), here.end());
  for (int i = 0; i < here.size(); i++) {
    id[here[i].second] = i + 1;
  }
  dfs(1, 0);
  cout << dp[1] << endl;
  return 0;
}
