#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7, M = 1e6 + 7, fo = 1e6;
template <class T>
inline void read(T &re) {
  char ch;
  while ((ch = getchar()) < '0' || ch > '9')
    ;
  re = ch - 48;
  while ((ch = getchar()) >= '0' && ch <= '9')
    re = (re << 3) + (re << 1) + ch - 48;
}
int num[N], tim[N], fa[N], tot, hd[N];
long long f[N];
struct road {
  int to, nxt, val;
} r[N];
struct TreeStructure {
  long long sum[M];
  inline void update(int x, long long ad) {
    for (register int i = x; i <= fo; i += i & -i) sum[i] += ad;
  }
  inline long long query(int x) {
    long long ret = 0;
    for (register int i = x; i; i -= i & -i) ret += sum[i];
    return ret;
  }
} st, sc;
inline void ade(int x, int y, int z) {
  r[++tot].to = y;
  r[tot].nxt = hd[x];
  r[tot].val = z;
  hd[x] = tot;
}
inline void DpOnTree(int x, long long t) {
  st.update(tim[x], 1ll * tim[x] * num[x]);
  sc.update(tim[x], num[x]);
  int L = 0, R = fo, mid, ans;
  while (L <= R) {
    mid = (L + R) >> 1;
    if (st.query(mid) <= t) {
      ans = mid;
      L = mid + 1;
    } else
      R = mid - 1;
  }
  f[x] = sc.query(ans);
  if (ans != fo) f[x] += (t - st.query(ans)) / (ans + 1);
  long long mx = 0, mx2 = 0;
  for (register int i = hd[x], u; i; i = r[i].nxt) {
    u = r[i].to;
    if (t - 2 * r[i].val < 0) continue;
    DpOnTree(u, t - 2 * r[i].val);
    if (f[u] >= mx)
      mx2 = mx, mx = f[u];
    else if (f[u] > mx2)
      mx2 = f[u];
  }
  if (x != 1)
    f[x] = max(f[x], mx2);
  else
    f[x] = max(f[x], mx);
  st.update(tim[x], -1ll * tim[x] * num[x]);
  sc.update(tim[x], -num[x]);
}
int main() {
  int n, w;
  long long T;
  read(n);
  read(T);
  for (register int i = 1; i <= n; ++i) read(num[i]);
  for (register int i = 1; i <= n; ++i) read(tim[i]);
  for (register int i = 2; i <= n; ++i) {
    read(fa[i]);
    read(w);
    ade(fa[i], i, w);
  }
  DpOnTree(1, T);
  printf("%lld", f[1]);
}
