#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, t;
  cin >> n >> t;
  vector<long long> x((size_t)n);
  for (long long i = 0; i < n; i++) {
    cin >> x[i];
  }
  vector<long long> y((size_t)n);
  for (long long i = 0; i < n; i++) {
    cin >> y[i];
  }
  vector<vector<long long>> children((size_t)n);
  vector<long long> z((size_t)n, 0);
  for (long long i = 1; i < n; i++) {
    long long p;
    cin >> p >> z[i];
    p--;
    children[p].push_back(i);
  }
  vector<long long> bit_time((size_t)1e7, 0), bit_count((size_t)1e7, 0);
  auto bit_add = [&](vector<long long> &bit, long long x, long long y) {
    for (x++; x < (long long)1e7; x += x & -x) {
      bit[x] += y;
    }
  };
  auto bit_query = [&](vector<long long> &bit, long long x) {
    long long y = 0;
    for (x++; x > 0; x -= x & -x) {
      y += bit[x];
    }
    return y;
  };
  auto bit_single = [&](vector<long long> &bit, long long x) {
    return bit_query(bit, x) - bit_query(bit, x - 1);
  };
  auto bit_search = [&](vector<long long> &bit, long long x) {
    long long y = 0;
    for (long long i = 1 << 24, j = 0; i > 0; i /= 2) {
      if (y + i < (long long)1e7 - 3 && j + bit[y + i] <= x) {
        j += bit[y + i];
        y += i;
      }
    }
    return y - 1;
  };
  vector<long long> dp((size_t)n, 0);
  function<void(long long, long long)> visit = [&](long long u, long long t) {
    bit_add(bit_time, y[u], y[u] * x[u]);
    bit_add(bit_count, y[u], x[u]);
    {
      long long i = bit_search(bit_time, t);
      long long time = bit_query(bit_time, i);
      long long count = bit_query(bit_count, i);
      if (i != -1) {
        count += min((t - time) / (i + 1), bit_single(bit_count, i + 1));
      }
      dp[u] = max(dp[u], count);
    }
    {
      vector<long long> g{0, 0};
      for (long long v : children[u]) {
        visit(v, t - z[v] * 2);
        g.push_back(dp[v]);
      }
      sort(g.begin(), g.end());
      if (u != 0) {
        g.pop_back();
      }
      dp[u] = max(dp[u], g.back());
    }
    bit_add(bit_count, y[u], -x[u]);
    bit_add(bit_time, y[u], -y[u] * x[u]);
  };
  visit(0, t);
  cout << dp[0] << endl;
  return 0;
}
