#include <bits/stdc++.h>
using namespace std;
long long n, t;
long long numOfCookies[100005];
long long timeForCookie[100005], timeSorted[100005];
map<long long, long long> pos;
vector<pair<long long, long long>> graph[100005];
pair<long long, long long> seg[262200];
void add(long long node, long long num, long long time) {
  seg[node].first += num;
  seg[node].second += time;
  if (node == 0) {
    return;
  }
  add((node - 1) / 2, num, time);
}
long long cal(long long node, long long timeLeft) {
  if (seg[node].second <= timeLeft) {
    return seg[node].first;
  } else if (node >= 131071) {
    if (seg[node].first != 0) {
      return timeLeft / (seg[node].second / seg[node].first);
    } else {
      return 0;
    }
  } else {
    long long help = cal(node * 2 + 1, timeLeft);
    if (timeLeft > seg[node * 2 + 1].second) {
      help += cal(node * 2 + 2, timeLeft - seg[node * 2 + 1].second);
    }
    return help;
  }
}
long long fun(long long node, long long timeLeft) {
  add(131071 + pos[timeForCookie[node]], numOfCookies[node],
      timeForCookie[node] * numOfCookies[node]);
  long long ret = cal(0, timeLeft);
  long long max1 = 0, max2 = 0;
  for (auto p : graph[node]) {
    if (timeLeft - 2 * p.second) {
      long long help = fun(p.first, timeLeft - 2 * p.second);
      if (help > max1) {
        max2 = max1;
        max1 = help;
      } else if (help > max2) {
        max2 = help;
      }
    }
  }
  add(131071 + pos[timeForCookie[node]], -1 * numOfCookies[node],
      -1 * timeForCookie[node] * numOfCookies[node]);
  return max(ret, (node == 1 ? max1 : max2));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> t;
  for (long long i = 1; i <= n; ++i) {
    cin >> numOfCookies[i];
  }
  for (long long i = 1; i <= n; ++i) {
    cin >> timeForCookie[i];
    timeSorted[i - 1] = timeForCookie[i];
  }
  for (long long i = 2; i <= n; ++i) {
    long long par;
    cin >> par;
    long long w;
    cin >> w;
    graph[par].push_back({i, w});
  }
  sort(timeSorted, timeSorted + n);
  for (long long i = 0; i < n; ++i) {
    pos[timeSorted[i]] = i;
  }
  cout << fun(1, t) << "\n";
  return 0;
}
