#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <numeric>
#include <climits>
#include <cfloat>
struct Next {
	int next_skill, need;
};
struct Skill {
	int upper_limit, importance;
};
std::vector<long long int> add_with_range(const std::vector<long long int>& memo, const int lower_limit, const int upper_limit, const long long int importance) {
	std::vector<long long int> result(memo.size(), LLONG_MIN);
	std::deque<int> deque;
	for (auto i = lower_limit; i < memo.size(); ++i) {
		while (!deque.empty() && i - deque.front() > upper_limit) {
			deque.pop_front();
		}
		while (!deque.empty() && memo[deque.back()] - deque.back() * importance < memo[i - lower_limit] - (i - lower_limit) * importance) {
			if (memo[i - lower_limit] == LLONG_MIN) throw "fail";
			deque.pop_back();
		}
		if (memo[i - lower_limit] != LLONG_MIN) deque.push_back(i - lower_limit);
		if (!deque.empty()) result[i] = memo[deque.front()] + (i - deque.front()) * importance;
	}
	return result;
}

std::vector<long long int> search(std::vector<std::vector<Next>>& node, const int current, const std::vector<Skill>& skills, const std::vector<long long int>& memo) {
	if (node[current].empty()) {
		return add_with_range(memo, 0, skills[current].upper_limit, skills[current].importance);
	}
	else {
		std::sort(node[current].begin(), node[current].end(), [](const Next& a, const Next& b) {return a.need < b.need; });
		std::vector<long long int> result(memo.size(), LLONG_MIN);
		auto prev = memo;
		for (const auto &next: node[current]) {
			prev = search(node, next.next_skill, skills, prev);
			auto temp = add_with_range(prev, next.need, skills[current].upper_limit, skills[current].importance);
			for (auto i = next.need; i < result.size(); ++i) {
				result[i] = std::max(result[i], temp[i]);
			}
		}
		prev = add_with_range(memo, 0, skills[current].upper_limit, skills[current].importance);
		for (auto i = 0; i < result.size(); ++i) result[i] = std::max(result[i], prev[i]);
		return result;
	}

}
int main() {
	while (true) {
		int n, k; std::cin >> n >> k; if (n == 0 && k == 0) break;
		std::vector<Skill> skills(n); for (auto& s : skills) std::cin >> s.upper_limit; for (auto& s : skills) std::cin >> s.importance;
		std::vector<std::vector<Next>> node(n);
		std::vector<int> parent(n), lower_limit(n);
		for (auto i = 1; i < n; ++i) std::cin >> parent[i];
		for (auto i = 1; i < n; ++i) std::cin >> lower_limit[i];
		for (auto i = 1; i < n; ++i) {
			node[parent[i] - 1].push_back({ i, lower_limit[i] });
		}
		auto result = search(node, 0, skills, std::vector<long long int>(k + 1, 0LL));
		std::cout << result.back() << std::endl;
	}
}
