#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const long long maxn = 112345;
long long n;
vector<pair<long long, long long> > adj[maxn];
long long cCont[1000005];
long long cTime[1000005];
long long tree[4000200][2];
long long val[100005];
pair<long long, long long> query(long long ind, long long l, long long r,
                                 long long ql, long long qr) {
  if (ql > qr) return make_pair(0, 0);
  if (ql == l && qr == r) {
    return make_pair(tree[ind][0], tree[ind][1]);
  }
  long long mid = (l + r) / 2;
  pair<long long, long long> a = query(ind * 2 + 1, l, mid, ql, min(qr, mid));
  pair<long long, long long> b =
      query(ind * 2 + 2, mid + 1, r, max(ql, mid + 1), qr);
  return make_pair(a.first + b.first, a.second + b.second);
}
void update(long long ind, long long l, long long r, long long pos,
            long long added_cookie) {
  if (l == r) {
    tree[ind][0] += added_cookie * l;
    tree[ind][1] += added_cookie;
  } else {
    long long mid = (l + r) / 2;
    if (pos <= mid)
      update(ind * 2 + 1, l, mid, pos, added_cookie);
    else
      update(ind * 2 + 2, mid + 1, r, pos, added_cookie);
    tree[ind][0] = tree[ind * 2 + 1][0] + tree[ind * 2 + 2][0];
    tree[ind][1] = tree[ind * 2 + 1][1] + tree[ind * 2 + 2][1];
  }
}
long long check(long long x, long long t) {
  pair<long long, long long> val = query(0, 0, 1000001, 0, x);
  pair<long long, long long> val2 = query(0, 0, 1000001, x, x);
  if (val.first <= t)
    return val.second;
  else if (val.first - val2.first <= t) {
    long long z = val.second - val2.second;
    long long tleft = t - (val.first - val2.first);
    long long y = tleft / x;
    return z + y;
  }
  return -1;
}
long long dfs(long long s, long long t) {
  if (t < 0) return 0;
  long long val;
  ;
  update(0, 0, 1000001, cTime[s], cCont[s]);
  long long l = 0, r = 1000001, mid;
  while (l < r) {
    long long mid = (l + r + 1) / 2;
    if (check(mid, t) != -1) {
      l = mid;
    } else {
      r = mid - 1;
    }
  }
  val = check(l, t);
  long long high = -200000000000000ll;
  long long secHigh = -200000000000000ll;
  for (auto child : adj[s]) {
    long long to = child.first;
    long long w = child.second;
    long long x = dfs(to, t - 2 * w);
    if (x > high) {
      secHigh = high;
      high = x;
    } else if (x > secHigh) {
      secHigh = x;
    }
  };
  update(0, 0, 1000001, cTime[s], -1 * cCont[s]);
  if (s == 0) return max(high, val);
  return max(secHigh, val);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  long long n, t, x, y;
  cin >> n >> t;
  for (long long i = 0, _n = (n); i < _n; i++) {
    cin >> cCont[i];
  }
  for (long long i = 0, _n = (n); i < _n; i++) {
    cin >> cTime[i];
  }
  for (long long i = 0, _n = (n - 1); i < _n; i++) {
    cin >> x >> y;
    x--;
    adj[x].push_back(make_pair(i + 1, y));
  }
  cout << dfs(0, t);
}
