#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  cin >> x;
}
template <typename T, typename T0>
void read(T &x, T0 &y) {
  cin >> x >> y;
}
template <typename T, typename T0, typename T1>
void read(T &x, T0 &y, T1 &z) {
  cin >> x >> y >> z;
}
template <typename T, typename T0, typename T1, typename T2>
void read(T &x, T0 &y, T1 &z, T2 &w) {
  cin >> x >> y >> z >> w;
}
template <typename T, typename T0>
void read(pair<T, T0> &p) {
  cin >> p.first >> p.second;
}
template <typename T>
void read(vector<T> &oneD) {
  for (long long i = 0; i < oneD.size(); i++) {
    read(oneD[i]);
  }
}
template <typename T>
void read(T oneD[], int n) {
  for (long long i = 0; i < n; i++) {
    read(oneD[i]);
  }
}
template <typename T>
void write(T &x) {
  cout << x << " ";
}
template <typename T, typename T0>
void write(T &x, T0 &y) {
  cout << x << " " << y << "\n";
}
template <typename T, typename T0, typename T1>
void write(T &x, T0 &y, T1 &z) {
  cout << x << " " << y << " " << z << "\n";
}
template <typename T, typename T0, typename T1, typename T2>
void write(T &x, T0 &y, T1 &z, T2 &w) {
  cout << x << " " << y << " " << z << " " << w << "\n";
}
template <typename T, typename T0>
void write(pair<T, T0> &p) {
  write(p.first);
  write(p.second);
  cout << "\n";
}
template <typename T>
void write(vector<T> &oneD) {
  for (long long i = 0; i < oneD.size(); i++) {
    write(oneD[i]);
  }
  cout << "\n";
}
template <typename T>
void write(T oneD[], int n) {
  for (long long i = 0; i < n; i++) {
    write(oneD[i]);
  }
  cout << "\n";
}
template <typename T, typename T0>
void write(map<T, T0> &mpp) {
  for (auto it : mpp) {
    write(it.first);
    cout << ": ";
    write(it.second);
    cout << "\n";
  }
  cout << "\n";
}
vector<long long> seive;
void Seive() {
  const long long maxn = 1000005;
  seive.resize(maxn);
  for (long long(i) = 0; (i) < (maxn); ++(i)) seive[i] = i;
  seive[1] = -1;
  seive[0] = -1;
  for (long long(i) = 2; (i) <= (maxn); (i) += (1))
    if (i == seive[i])
      for (long long j = 2 * i; j < maxn; j += i)
        if (seive[j] == j) seive[j] = i;
}
long long extended_GCD(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = extended_GCD(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return gcd;
}
long long power(long long a, long long b, long long m = 1000000007) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long modinv(long long a, long long mod = 1000000007) {
  long long x, y;
  extended_GCD(a, mod, x, y);
  if (x < 0) x += mod;
  return x;
}
const int N = 1e5 + 5;
long long n, t;
vector<pair<long long, long long> > tree[N];
long long X[N];
long long T[N];
long long P[N];
long long L[N];
long long dist[N];
long long value[N];
const int maxn = 1e6 + 5;
pair<long long, long long> seg[4 * maxn];
long long ti[maxn];
void update(long long node, long long s, long long e, long long ind,
            long long v) {
  if (s == e) {
    seg[node].first += v;
    seg[node].second = seg[node].first * s;
    ti[s] += v;
  } else {
    long long m = s + e >> 1;
    if (ind <= m)
      update(node << 1, s, m, ind, v);
    else
      update(node << 1 | 1, m + 1, e, ind, v);
    seg[node].first = seg[node << 1].first + seg[node << 1 | 1].first;
    seg[node].second = seg[node << 1].second + seg[node << 1 | 1].second;
  }
}
pair<long long, long long> query(long long node, long long s, long long e,
                                 long long l, long long r) {
  if (s > r || e < l) return {0, 0};
  if (s >= l && e <= r) return seg[node];
  long long m = s + e >> 1;
  pair<long long, long long> p1 = query(node << 1, s, m, l, r);
  pair<long long, long long> p2 = query(node << 1 | 1, m + 1, e, l, r);
  return {p1.first + p2.first, p1.second + p2.second};
}
void dfs0(long long v) {
  dist[v] = L[v] + dist[P[v]];
  for (auto x : tree[v]) {
    if (x.first != P[v]) {
      dfs0(x.first);
    }
  }
}
void dfs1(long long v) {
  update(1, 0, maxn - 1, T[v], X[v]);
  long long left = t - (2 * dist[v]);
  long long s = 0, e = maxn;
  while ((e - s) > 5) {
    long long m = (s + e) / 2;
    pair<long long, long long> v = query(1, 0, maxn - 1, 0, m);
    if (v.second > left) {
      e = m;
    } else {
      s = m;
    }
  }
  long long vv = s;
  for (long long(m) = s; (m) <= (e); (m) += (1)) {
    pair<long long, long long> v = query(1, 0, maxn - 1, 0, m);
    if (v.second <= left) {
      vv = m;
    }
  }
  pair<long long, long long> cur = query(1, 0, maxn - 1, 0, vv);
  value[v] = cur.first;
  left -= cur.second;
  long long temp = vv + 1;
  s = vv + 1;
  e = maxn;
  while ((e - s) > 5) {
    long long m = (s + e) / 2;
    pair<long long, long long> vvvv = query(1, 0, maxn - 1, temp, m);
    if (vvvv.first <= 0) {
      s = m;
    } else {
      e = m;
    }
  }
  vv = s;
  for (long long(m) = s; (m) <= (e); (m) += (1)) {
    pair<long long, long long> vvvv = query(1, 0, maxn - 1, temp, m);
    if (vvvv.first > 0) {
      vv = m;
      break;
    }
  }
  if (vv != (maxn + 1)) value[v] += (left / vv);
  for (auto x : tree[v]) {
    if (x.first != P[v]) {
      dfs1(x.first);
    }
  }
  update(1, 0, maxn - 1, T[v], -1 * X[v]);
}
long long dfs2(long long v) {
  vector<long long> child;
  for (auto x : tree[v]) {
    if (x.first != P[v]) {
      long long val = dfs2(x.first);
      child.push_back(val);
    }
  }
  sort(child.rbegin(), child.rend());
  if (child.size() <= 1) {
    return value[v];
  }
  if (v == 1) {
    long long ret = child[0];
    for (auto x : tree[v]) {
      ret = max(ret, value[x.first]);
    }
    return ret;
  }
  return max(value[v], child[1]);
}
long long ans[N];
void f(long long x) {
  multiset<long long> s;
  if (tree[x].size() == 1 && x != 1) {
    ans[x] = value[x];
    return;
  }
  for (auto to : tree[x]) {
    if (to.first == P[x]) continue;
    f(to.first);
    s.insert(ans[to.first]);
  }
  ans[x] = value[x];
  if (x != 1) s.erase(--s.end());
  if (!s.empty()) ans[x] = max(ans[x], *(--s.end()));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> t;
  for (long long(i) = 0; (i) < (4 * maxn); ++(i)) {
    seg[i] = {0, 0};
  }
  for (long long(i) = 0; (i) < (maxn); ++(i)) ti[i] = 0;
  for (long long(i) = 1; (i) <= (n); ++(i)) cin >> X[i];
  for (long long(i) = 1; (i) <= (n); ++(i)) cin >> T[i];
  P[1] = 0;
  L[1] = 0;
  for (long long(i) = 2; (i) <= (n); (i) += (1)) {
    cin >> P[i] >> L[i];
    tree[P[i]].push_back({i, L[i]});
    tree[i].push_back({P[i], L[i]});
  }
  dfs0(1);
  dfs1(1);
  f(1);
  cout << ans[1] << "\n";
  return 0;
}
