#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const double dinf = 1e250;
const long long INF = (long long)(2e18);
const long long inf = (long long)(1e9 + 7);
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <class T>
void OUT(T a) {
  cout << a;
  exit(0);
}
template <class T1, class T2>
inline T1& maxeq(T1& a, T2 b) {
  return a = max(a, b);
}
template <class T1, class T2>
inline T1& mineq(T1& a, T2 b) {
  return a = min(a, b);
}
mt19937 rng((uint32_t)(chrono::steady_clock::now().time_since_epoch().count()));
chrono::time_point<chrono::steady_clock> cl;
double current_time() {
  return (chrono::steady_clock::now() - cl).count() / 1e9;
}
vector<long long> x;
vector<long long> tt;
vector<long long> l;
vector<vector<long long> > g;
vector<long long> xt;
vector<long long> res;
struct pt {
  long long x, y;
  pt(long long x = 0, long long y = 0) : x(x), y(y) {}
  pt& operator+=(pt b) {
    x += b.x;
    y += b.y;
    return *this;
  }
  pt operator+(pt b) {
    pt tmp(x, y);
    return tmp += b;
  }
};
struct stree {
  vector<pt> t;
  long long n;
  stree() {}
  stree(long long nn) {
    for (n = 1; n < nn; n <<= 1) {
    }
    t.resize(2 * n);
  }
  void set(long long i, pt x) {
    t[i += n] += x;
    for (i >>= 1; i; i >>= 1) t[i] = t[i + i] + t[i + i + 1];
  }
  long long get(long long T) {
    if (t[1].x <= T) return t[1].y;
    pt cur;
    long long i;
    for (i = 1; i < n;) {
      if (t[i + i].x + cur.x > T)
        i += i;
      else {
        cur += t[i + i];
        i += i + 1;
      }
    }
    if (t[i].y == 0) return cur.y;
    return cur.y + (T - cur.x) / (t[i].x / t[i].y);
  }
};
stree tr;
void dfs(long long v, long long T) {
  tr.set(tt[v], pt(xt[tt[v]] * x[v], x[v]));
  res[v] = tr.get(T);
  for (auto& it : g[v]) {
    if (2 * l[it] >= T) continue;
    dfs(it, T - 2 * l[it]);
  }
  tr.set(tt[v], pt(-xt[tt[v]] * x[v], -x[v]));
}
long long dfs2(long long v) {
  long long out1 = 0;
  long long out2 = 0;
  for (auto& it : g[v]) {
    out2 = max(out2, dfs2(it));
    if (out1 < out2) swap(out1, out2);
  }
  if (v == 0) return max(out1, res[v]);
  return max(out2, res[v]);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cl = chrono::steady_clock::now();
  cin.tie(0);
  long long n, T;
  cin >> n >> T;
  res.resize(n, 0);
  x.resize(n, 0);
  l.resize(n, 0);
  tt.resize(n, 0);
  g.resize(n);
  for (auto& it : x) cin >> it;
  for (auto& it : tt) cin >> it;
  for (long long i = 1; i < n; ++i) {
    long long p;
    cin >> p >> l[i];
    --p;
    g[p].push_back(i);
  }
  xt = tt;
  sort((xt).begin(), (xt).end());
  xt.resize(unique((xt).begin(), (xt).end()) - xt.begin());
  for (auto& it : tt)
    it = lower_bound((xt).begin(), (xt).end(), it) - xt.begin();
  stree kek(xt.size());
  swap(tr, kek);
  dfs(0, T);
  cout << dfs2(0);
  return 0;
}
