#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') {
      f = -1;
    }
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - 48;
    c = getchar();
  }
  return x * f;
}
const int maxn = 100010;
int tot, head[maxn], ver[maxn], edge[maxn], nxt[maxn];
void add(int x, int y, int w) {
  ver[++tot] = y;
  nxt[tot] = head[x];
  edge[tot] = w;
  head[x] = tot;
}
int n;
long long T;
long long r[maxn], t[maxn], f[maxn], f2[maxn];
namespace Binary {
const int maxt = 1e6;
struct Binary {
  long long c[maxt + 10];
  void add(int x, long long y) {
    for (; x <= maxt; x += x & -x) {
      c[x] += y;
    }
  }
  long long ask(int x) {
    long long ans = 0;
    for (; x; x -= x & -x) {
      ans += c[x];
    }
    return ans;
  }
};
}  // namespace Binary
Binary::Binary a, b;
long long check(long long T) {
  int l = 1, r = Binary::maxt + 1;
  while (l < r) {
    int mid = (l + r) >> 1;
    if (a.ask(mid) <= T) {
      l = mid + 1;
    } else {
      r = mid;
    }
  }
  return l - 1;
}
void dfs(int x, long long dis) {
  long long rest = T - 2 * dis;
  a.add(t[x], t[x] * r[x]);
  b.add(t[x], r[x]);
  int now = check(rest);
  f[x] = b.ask(now);
  if (now != Binary::maxt) {
    f[x] += (rest - a.ask(now)) / (now + 1);
  }
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i], z = edge[i];
    dfs(y, dis + z);
  }
  a.add(t[x], -t[x] * r[x]);
  b.add(t[x], -r[x]);
  long long max1 = 0, max2 = 0;
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    if (f2[y] >= max1) {
      max2 = max1;
      max1 = f2[y];
    } else if (f2[y] >= max2) {
      max2 = f2[y];
    }
  }
  if (x == 1) {
    f2[x] = max(f[x], max1);
  } else {
    f2[x] = max(f[x], max2);
  }
}
int main() {
  scanf("%d %lld", &n, &T);
  for (int i = 1; i <= n; ++i) {
    r[i] = read();
  }
  for (int i = 1; i <= n; ++i) {
    t[i] = read();
  }
  for (int i = 2; i <= n; ++i) {
    int fa = read(), l = read();
    add(fa, i, l);
  }
  dfs(1, 0);
  printf("%lld\n", f2[1]);
  return 0;
}
