#include <bits/stdc++.h>
using namespace std;
template <class T, int SZ>
class SegmenetTree {
 private:
  T val[SZ * 4];
  T cnt[SZ * 4];
  pair<int, int> range[SZ * 4];
  void clear() { memset(val, 0, sizeof(val)), memset(cnt, 0, sizeof(cnt)); }
  void build(int idx, int l, int r) {
    range[idx] = {l, r};
    if (l != r) {
      int mi = (l + r) >> 1;
      build(idx + idx, l, mi);
      build(idx + idx + 1, mi + 1, r);
    }
  }
  int getIdx(int pos) {
    int l(1), r(SZ), idx(1);
    while (l < r) {
      int mi((l + r) >> 1);
      idx <<= 1;
      if (mi >= pos) {
        r = mi;
      } else {
        ++idx, l = mi + 1;
      }
    }
    return idx;
  }

 public:
  SegmenetTree() { build(1, 1, SZ), clear(); }
  void add(int pos, T v) {
    int idx(getIdx(pos));
    for (; idx > 0; idx >>= 1) {
      val[idx] += pos * v;
      cnt[idx] += v;
    }
  }
  T query(T total) { return query(total, 1); }
  T query(T total, int idx) {
    if (total < val[idx]) {
      if (range[idx].first != range[idx].second) {
        int nidx(idx << 1);
        T result = query(total, nidx);
        total -= val[nidx];
        if (total > 0) {
          result += query(total, nidx + 1);
        }
        return result;
      } else if (total > 0) {
        return total / range[idx].first;
      } else {
        return 0;
      }
    }
    return cnt[idx];
  }
};
SegmenetTree<long long, 1000100> st;
long long x[100010], t[100010];
vector<int> edge[100010];
vector<int> cost[100010];
long long dp[100010];
long long dfs(int now, long long rest) {
  if (rest <= 0) {
    dp[now] = 0;
    return dp[now];
  }
  st.add(t[now], x[now]);
  vector<long long> ch;
  for (int i = 0; i < edge[now].size(); i++) {
    int y = edge[now][i];
    int c = cost[now][i];
    ch.push_back(dfs(y, rest - c));
  }
  dp[now] = st.query(rest);
  if (ch.size() > 1) {
    sort(ch.begin(), ch.end());
    dp[now] = max(dp[now], ch[ch.size() - 2]);
  }
  st.add(t[now], -x[now]);
  return dp[now];
}
int main() {
  long long n, T;
  int i, j;
  cin >> n >> T;
  for (i = 1; i < n + 1; i++) {
    cin >> x[i];
  }
  for (i = 1; i < n + 1; i++) {
    cin >> t[i];
  }
  for (i = 2; i < n + 1; i++) {
    long long p, c;
    cin >> p >> c;
    edge[p].push_back(i);
    cost[p].push_back(c + c);
  }
  dfs(1, T);
  long long ans = dp[1];
  for (i = 0; i < edge[1].size(); i++) {
    int y(edge[1][i]);
    ans = max(ans, dp[y]);
  }
  cout << ans << endl;
}
