#include <bits/stdc++.h>
using namespace std;
struct SegNode {
  int l, r;
  long long cnt, sum;
  SegNode *left, *right;
};
const int MAXN = 100005;
pair<int, int> a[MAXN];
int pid[MAXN], id[MAXN];
vector<pair<int, int> > g[MAXN];
SegNode *root;
bool comp(int x, int y) { return a[x].second < a[y].second; }
SegNode *BuildTree(int l, int r) {
  SegNode *ret = new SegNode();
  int mid = (l + r) >> 1;
  ret->l = l;
  ret->r = r;
  ret->sum = ret->cnt = 0;
  if (mid < r)
    ret->left = BuildTree(l, mid), ret->right = BuildTree(mid + 1, r);
  else
    ret->left = ret->right = NULL;
  return ret;
}
void SegUpdate(SegNode *cur, int pos, int x, int t) {
  int mid = (cur->l + cur->r) >> 1;
  if (cur->l == cur->r)
    cur->cnt += x, cur->sum += 1LL * x * t;
  else {
    if (pos <= mid)
      SegUpdate(cur->left, pos, x, t);
    else
      SegUpdate(cur->right, pos, x, t);
    cur->cnt = cur->left->cnt + cur->right->cnt;
    cur->sum = cur->left->sum + cur->right->sum;
  }
  return;
}
long long SegQuery(SegNode *cur, long long T) {
  if (T <= 0) return 0;
  if (cur->sum <= T) return cur->cnt;
  if (cur->l == cur->r)
    return T / (cur->sum / cur->cnt);
  else
    return SegQuery(cur->left, T) + SegQuery(cur->right, T - cur->left->sum);
}
long long DFS(int u, long long T) {
  long long ma[2], ret;
  int mn = 0;
  SegUpdate(root, id[u], a[u].first, a[u].second);
  if ((u != 1 && g[u].size() == 1) || g[u].size() == 0)
    ret = SegQuery(root, T);
  else {
    ret = SegQuery(root, T);
    for (auto &p : g[u]) {
      long long t = DFS(p.first, T - p.second * 2);
      if (mn < 2)
        ma[mn++] = t;
      else
        ma[1] = max(ma[1], t);
      if (mn == 2 && ma[1] > ma[0]) swap(ma[0], ma[1]);
    }
    if (mn > 0) ret = max(ret, u == 1 ? ma[0] : ma[1]);
  }
  SegUpdate(root, id[u], -a[u].first, a[u].second);
  return ret;
}
int main() {
  int n;
  long long T;
  scanf("%d%lld", &n, &T);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i].first);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i].second), pid[i] = i;
  sort(pid + 1, pid + n + 1, comp);
  for (int i = 1; i <= n; ++i) id[pid[i]] = i;
  for (int i = 2, p, l; i <= n; ++i)
    scanf("%d%d", &p, &l), g[p].emplace_back(i, l);
  root = BuildTree(1, n);
  printf("%lld\n", DFS(1, T));
  return 0;
}
