#include <bits/stdc++.h>
using namespace std;
int n;
long long p[300000], l[300000];
long long cookies[300000];
pair<long long, pair<long long, long long> > tx[300000];
long long T;
vector<long long> c[300000];
set<pair<long long, pair<long long, long long> > > txs;
pair<long long, pair<long long, long long> > r =
    make_pair(1ll << 60, make_pair(1, -1));
long long cs = 1, t = 1ll << 60;
long long rx = 1;
void adjust(int v) {
  if (rx < 0) {
    cout << "ALARM" << endl;
  }
  if (rx < r.second.first) {
    t += r.first * (r.second.first - rx);
    cs += (r.second.first - rx);
    rx = r.second.first;
  }
  while (t < T) {
    auto ry = txs.find(r);
    ++ry;
    r = *ry;
    rx = r.second.first;
    t += r.first * rx;
    cs += rx;
  }
  while (t > T) {
    if (rx < 0 || rx > 1000000) {
      cout << "ALARMX: " << rx << endl;
    }
    if (r.first < 0) {
      cout << "ALARMY: " << r.first << endl;
    }
    if (rx == 0 || t - r.first * rx > T) {
      t -= r.first * rx;
      cs -= rx;
      auto ry = txs.find(r);
      if (ry == txs.begin()) {
        cout << "ALARMZ" << endl;
      }
      --ry;
      r = *ry;
      rx = r.second.first;
    } else {
      int d = (t - T + r.first - 1) / r.first;
      t -= r.first * d;
      rx -= d;
      cs -= d;
    }
  }
}
int dfs(int v) {
  T -= 2 * l[v];
  if (T > 0) {
    if (tx[v] < r) {
      cs += tx[v].second.first;
      t += tx[v].second.first * tx[v].first;
    }
    txs.insert(tx[v]);
    adjust(v);
    cookies[v] = cs;
    vector<long long> res;
    for (int u : c[v]) {
      res.push_back(dfs(u));
    }
    sort(res.begin(), res.end());
    if (res.size() >= 2) cookies[v] = max(cookies[v], res[res.size() - 2]);
    if (v == 0 && res.size() >= 1)
      cookies[v] = max(cookies[v], res[res.size() - 1]);
    if (r == tx[v]) {
      t -= r.first * rx;
      cs -= rx;
      auto ry = txs.find(r);
      --ry;
      r = *ry;
      rx = r.second.first;
    } else if (tx[v] < r) {
      cs -= tx[v].second.first;
      t -= tx[v].second.first * tx[v].first;
    }
    txs.erase(tx[v]);
  }
  T += 2 * l[v];
  return cookies[v];
}
void solve() {
  cin >> n >> T;
  for (int i = 0; i < n; ++i) {
    cin >> tx[i].second.first;
    tx[i].second.second = i;
  }
  for (int i = 0; i < n; ++i) {
    cin >> tx[i].first;
  }
  for (int i = 1; i < n; ++i) {
    cin >> p[i] >> l[i];
    --p[i];
    c[p[i]].push_back(i);
  }
  txs.insert(make_pair(1, make_pair(1, -1)));
  txs.insert(r);
  txs.insert(make_pair(1ll << 60, make_pair(1, 1)));
  cout << dfs(0) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout << setprecision(12) << fixed;
  solve();
  return 0;
}
