#include <bits/stdc++.h>
using namespace std;
long long fake, ans[1000010], T, num[1000010], t[1000010], n, l[1000010],
    p[1000010];
vector<long long> son[1000010];
struct node {
  long long c[1000020];
  void add(long long x, long long k) {
    while (x <= 1000010) {
      c[x] += k;
      x += (x & (-x));
    }
  }
  long long query(long long x) {
    long long anss = 0;
    while (x) {
      anss += c[x];
      x -= (x & (-x));
    }
    return anss;
  }
} a, b;
long long midfindc(long long rest) {
  long long l = 0, r = 1000000, mid, re = 0;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (a.query(mid) <= rest) {
      re = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  fake = l;
  return re;
}
long long midfindnow(long long x) {
  long long l = fake, r = 1000000, re = 0, mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (b.query(mid) != ans[x]) {
      re = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  return re;
}
void dfs(long x, long long dis) {
  long long rest = T - 2 * dis;
  a.add(t[x], num[x] * t[x]);
  b.add(t[x], num[x]);
  long long cookie = midfindc(rest);
  if (cookie) {
    ans[x] = b.query(cookie);
    rest -= a.query(cookie);
  }
  cookie = midfindnow(x);
  if (cookie) {
    ans[x] += rest / cookie;
  }
  for (int i = 0; i < son[x].size(); i++) {
    dfs(son[x][i], dis + l[son[x][i]]);
  }
  a.add(t[x], -num[x] * t[x]);
  b.add(t[x], -num[x]);
  long long maxn = -1, del = 0;
  for (int i = 0; i < son[x].size(); i++) {
    if (ans[son[x][i]] > maxn) {
      maxn = ans[son[x][i]];
      del = son[x][i];
    }
  }
  if (x == 1) {
    ans[x] = max(ans[x], maxn);
    return;
  }
  for (int i = 0; i < son[x].size(); i++) {
    if (son[x][i] != del) {
      ans[x] = max(ans[x], ans[son[x][i]]);
    }
  }
}
int main() {
  cin >> n >> T;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &num[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &t[i]);
  }
  for (int i = 2; i <= n; i++) {
    scanf("%I64d%I64d", &p[i], &l[i]);
    son[p[i]].push_back(i);
  }
  dfs(1, 0);
  cout << ans[1] << endl;
  return 0;
}
