#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f, Inf = 0x7fffffff;
const long long INF = 0x7ffffffffffffff;
const double eps = 1e-8;
unsigned int seed = 19260817;
__inline__ __attribute__((always_inline)) unsigned int Rand() {
  return seed = seed * 998244353u + 1000000007u;
}
template <typename _Tp>
_Tp gcd(const _Tp &a, const _Tp &b) {
  return (!b) ? a : gcd(b, a % b);
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) _Tp abs(const _Tp &a) {
  return a > 0 ? a : -a;
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) _Tp max(const _Tp &a, const _Tp &b) {
  return a < b ? b : a;
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) _Tp min(const _Tp &a, const _Tp &b) {
  return a < b ? a : b;
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) void chmax(_Tp &a, const _Tp &b) {
  (a < b) && (a = b);
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) void chmin(_Tp &a, const _Tp &b) {
  (a > b) && (a = b);
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) bool _cmp(const double &a,
                                                    const double &b) {
  return abs(a - b) <= eps;
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) void read(_Tp &x) {
  register char ch(getchar());
  bool f(false);
  while (ch < 48 || ch > 57) f |= ch == 45, ch = getchar();
  x = ch & 15, ch = getchar();
  while (ch >= 48 && ch <= 57)
    x = (((x << 2) + x) << 1) + (ch & 15), ch = getchar();
  if (f) x = -x;
}
template <typename _Tp, typename... Args>
__inline__ __attribute__((always_inline)) void read(_Tp &t, Args &...args) {
  read(t);
  read(args...);
}
__inline__ __attribute__((always_inline)) int read_str(char *s) {
  register char ch(getchar());
  while (ch < 65 || ch > 122 || (ch > 90 && ch < 97)) ch = getchar();
  register char *tar = s;
  *tar = ch, ch = getchar();
  while ((ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122))
    *(++tar) = ch, ch = getchar();
  return tar - s + 1;
}
const int N = 100005;
struct node {
  int x, t;
} a[N];
int b[N], t[N];
struct seg_tr {
  struct Node {
    int ls, rs;
    long long sum, tot;
  } f[N << 1];
  int node_cnt;
  __inline__ __attribute__((always_inline)) void PushUp(const int &x) {
    f[x].sum = f[f[x].ls].sum + f[f[x].rs].sum;
    f[x].tot = f[f[x].ls].tot + f[f[x].rs].tot;
  }
  int build(const int &l, const int &r) {
    int cur = ++node_cnt;
    if (l == r) {
      return cur;
    }
    int mid = (l + r) >> 1;
    f[cur].ls = build(l, mid);
    f[cur].rs = build(mid + 1, r);
    return cur;
  }
  void Update(const int &pos, const int &l, const int &r, const int &cur,
              const node &o) {
    if (l == r) {
      f[cur].sum += 1ll * o.x * o.t;
      f[cur].tot += o.x;
      return;
    }
    int mid = (l + r) >> 1;
    if (pos <= mid)
      Update(pos, l, mid, f[cur].ls, o);
    else
      Update(pos, mid + 1, r, f[cur].rs, o);
    PushUp(cur);
  }
  long long Query(const int &l, const int &r, const int &cur,
                  const long long &rest) {
    if (l == r) {
      if (rest >= f[cur].sum) return f[cur].tot;
      return rest / t[l];
    }
    int mid = (l + r) >> 1;
    if (rest >= f[f[cur].ls].sum) {
      return f[f[cur].ls].tot +
             Query(mid + 1, r, f[cur].rs, rest - f[f[cur].ls].sum);
    } else {
      return Query(l, mid, f[cur].ls, rest);
    }
  }
} tr;
struct edge {
  int v, nxt;
} c[N];
int fa[N], l[N];
int front[N], cnt;
int len;
long long f[N];
int root;
__inline__ __attribute__((always_inline)) void add(const int &u, const int &v) {
  c[++cnt] = (edge){v, front[u]}, front[u] = cnt;
}
void dfs(int x, long long rest) {
  rest -= l[x] << 1;
  tr.Update(b[x], 1, len, root, a[x]);
  f[x] = tr.Query(1, len, root, rest);
  for (int i = front[x]; i; i = c[i].nxt) {
    dfs(c[i].v, rest);
  }
  tr.Update(b[x], 1, len, root, (node){-a[x].x, a[x].t});
}
long long Dfs(int x) {
  long long first = 0, second = 0;
  for (int i = front[x]; i; i = c[i].nxt) {
    long long tmp = Dfs(c[i].v);
    if (tmp > first) {
      second = first;
      first = tmp;
    } else if (tmp > second) {
      second = tmp;
    }
  }
  return max(second, f[x]);
}
int main() {
  int n;
  long long T;
  read(n, T);
  for (int i = 1; i <= n; ++i) {
    read(a[i].x);
  }
  for (int i = 1; i <= n; ++i) {
    read(a[i].t);
    b[i] = t[i] = a[i].t;
  }
  std::sort(t + 1, t + n + 1);
  len = std::unique(t + 1, t + n + 1) - t - 1;
  root = tr.build(1, len);
  for (int i = 1; i <= n; ++i) {
    b[i] = std::lower_bound(t + 1, t + len + 1, b[i]) - t;
  }
  for (int i = 2; i <= n; ++i) {
    read(fa[i]);
    add(fa[i], i);
    read(l[i]);
  }
  dfs(1, T);
  long long ans = f[1];
  for (int i = front[1]; i; i = c[i].nxt) {
    chmax(ans, Dfs(c[i].v));
  }
  printf("%lld\n", ans);
  return 0;
}
