You are given a rooted tree on n vertices, its root is the vertex number 1. The i-th vertex contains a number w_i. Split it into the minimum possible number of vertical paths in such a way that each path contains no more than L vertices and the sum of integers w_i on each path does not exceed S. Each vertex should belong to exactly one path.

A vertical path is a sequence of vertices v_1, v_2, …, v_k where v_i (i ≥ 2) is the parent of v_{i - 1}.

Input

The first line contains three integers n, L, S (1 ≤ n ≤ 10^5, 1 ≤ L ≤ 10^5, 1 ≤ S ≤ 10^{18}) — the number of vertices, the maximum number of vertices in one path and the maximum sum in one path.

The second line contains n integers w_1, w_2, …, w_n (1 ≤ w_i ≤ 10^9) — the numbers in the vertices of the tree.

The third line contains n - 1 integers p_2, …, p_n (1 ≤ p_i < i), where p_i is the parent of the i-th vertex in the tree.

Output

Output one number — the minimum number of vertical paths. If it is impossible to split the tree, output -1.

Examples

Input

3 1 3
1 2 3
1 1


Output

3

Input

3 3 6
1 2 3
1 1


Output

2

Input

1 1 10000
10001


Output

-1

Note

In the first sample the tree is split into \{1\},\ \{2\},\ \{3\}.

In the second sample the tree is split into \{1,\ 2\},\ \{3\} or \{1,\ 3\},\ \{2\}.

In the third sample it is impossible to split the tree.
class ImpossibleTreeError(Exception):
	pass


def decompose_in_paths(root, weights, tree, max_paths, max_sum):
	if(weights[root] > max_sum):
		raise ImpossibleTreeError()

	if len(tree[root]) == 0:
		return {"paths": 1, "min_sum":weights[root], "len_min_sum": 1, "len_of_the_shortest": 1,  "sum_of_the_shortest":weights[root]}
	else:
		n_paths = 0
		min_sum = None
		len_of_the_min_sum = None
		len_of_the_shortest = None
		sum_of_the_shortest = None

		for child in tree[root]:
			each = decompose_in_paths(child, weights, tree, max_paths, max_sum)
			n_paths += each["paths"]

			if min_sum is None or (min_sum > each["min_sum"]):
				min_sum = each["min_sum"]
				len_of_the_min_sum = each["len_min_sum"]
			if len_of_the_shortest is None or (len_of_the_shortest > each["len_of_the_shortest"]):
				len_of_the_shortest = each["len_of_the_shortest"]
				sum_of_the_shortest = each["sum_of_the_shortest"]

		if min_sum + weights[root] <= max_sum:
			min_sum = min_sum + weights[root]
			len_of_the_min_sum += 1
			if len_of_the_min_sum > max_paths:
				min_sum = None
				len_of_the_min_sum = None
		else:
			min_sum = None
			len_of_the_min_sum = None

		if len_of_the_shortest + 1 <= max_paths:
			len_of_the_shortest = len_of_the_shortest + 1
			sum_of_the_shortest = sum_of_the_shortest +  weights[root]
			if sum_of_the_shortest > max_sum:
				len_of_the_shortest = None
				sum_of_the_shortest = None
		else:
			len_of_the_shortest = None
			sum_of_the_shortest = None
		
		if min_sum is None and len_of_the_shortest is None:
			return {"paths": n_paths + 1, "min_sum":weights[root], "len_min_sum": 1, "len_of_the_shortest": 1,  "sum_of_the_shortest":weights[root]}
		elif not (min_sum is None):
			return {"paths": n_paths, "min_sum":min_sum, "len_min_sum": len_of_the_min_sum, "len_of_the_shortest": len_of_the_min_sum,  "sum_of_the_shortest":min_sum}
		else:
			return {"paths": n_paths, "min_sum":sum_of_the_shortest, "len_min_sum": len_of_the_shortest, "len_of_the_shortest": len_of_the_shortest,  "sum_of_the_shortest":sum_of_the_shortest}

def decompose_in_paths_no_recursive(root_node, weights, tree, max_paths, max_sum):
	sols = {}
	stack = [root_node]
	while(stack):
		root = stack.pop()
		if(weights[root] > max_sum):
			raise ImpossibleTreeError()
		if len(tree[root]) == 0:
			sols[root] = {"paths_min_sum": 1, "paths_shortest": 1, "min_sum":weights[root], "len_min_sum": 1, "len_of_the_shortest": 1,  "sum_of_the_shortest":weights[root]}
		else:
			if not (tree[root][0] in sols):
				stack.append(root)
				for each in tree[root]:
					stack.append(each)
			else:
				paths_min_sum = 0
				paths_shortest = 0
				min_sum = None
				len_of_the_min_sum = None
				len_of_the_shortest = None
				sum_of_the_shortest = None

				for child in tree[root]:
					each = sols[child]
					del sols[child]


					if (each['len_min_sum'] + 1 <= max_paths) and (min_sum is None or (min_sum > each["min_sum"])) :
						min_sum = each["min_sum"]
						len_of_the_min_sum = each["len_min_sum"]
						paths_min_sum += each["paths_min_sum"]
					else:
						paths_min_sum += min(each["paths_min_sum"], each["paths_shortest"])

					if (each['sum_of_the_shortest'] + weights[root] <= max_sum) and (len_of_the_shortest is None or (len_of_the_shortest > each["len_of_the_shortest"])):
						len_of_the_shortest = each["len_of_the_shortest"]
						sum_of_the_shortest = each["sum_of_the_shortest"]
						paths_shortest += each["paths_shortest"]
					else:
						paths_shortest += min(each["paths_min_sum"], each["paths_shortest"])

				if not (min_sum is None):
					if min_sum + weights[root] <= max_sum:
						min_sum = min_sum + weights[root]
						len_of_the_min_sum += 1
						if len_of_the_min_sum > max_paths:
							min_sum = None
							len_of_the_min_sum = None
					else:
						min_sum = None
						len_of_the_min_sum = None

				if not (len_of_the_shortest is None):
					if len_of_the_shortest + 1 <= max_paths:
						len_of_the_shortest = len_of_the_shortest + 1
						sum_of_the_shortest = sum_of_the_shortest +  weights[root]
						if sum_of_the_shortest > max_sum:
							len_of_the_shortest = None
							sum_of_the_shortest = None
					else:
						len_of_the_shortest = None
						sum_of_the_shortest = None
				
				if min_sum is None and len_of_the_shortest is None:
					sols[root] = {"paths_min_sum": min(paths_shortest, paths_min_sum) + 1, "paths_shortest":min(paths_shortest, paths_min_sum) + 1, "min_sum":weights[root], "len_min_sum": 1, "len_of_the_shortest": 1,  "sum_of_the_shortest":weights[root]}
				elif len_of_the_shortest is None and not (min_sum is None):
					# Lo pude meter en min_sum pero no en shortest
					sols[root] = {"paths_min_sum": paths_min_sum , "min_sum":min_sum, "len_min_sum": len_of_the_min_sum, "len_of_the_shortest": len_of_the_min_sum,  "sum_of_the_shortest":min_sum, "paths_shortest":paths_min_sum}
				elif min_sum is None and not (len_of_the_shortest is None):
					sols[root] = {"paths_min_sum": paths_shortest, "min_sum":sum_of_the_shortest, "len_min_sum": len_of_the_shortest, "len_of_the_shortest": len_of_the_shortest,  "sum_of_the_shortest":sum_of_the_shortest, "paths_shortest":paths_shortest}
				else:
					sols[root] = {"paths_min_sum": paths_min_sum, "min_sum":min_sum, "len_min_sum": len_of_the_min_sum, "len_of_the_shortest": len_of_the_shortest,  "sum_of_the_shortest":sum_of_the_shortest, "paths_shortest":paths_shortest}
	return sols[root_node]



def minimum_decomposition(tree, weights, max_paths, max_sum):
	try:
		res = decompose_in_paths_no_recursive(1, weights, tree, max_paths, max_sum)
		return min(res['paths_shortest'], res['paths_min_sum'])
	except ImpossibleTreeError:
		return -1
	

import fileinput
from collections import defaultdict

lines = [line.replace("\n","") for line in fileinput.input()]
n, max_paths, max_sum = map(int, lines[0].split(" "))
weights = {}
i = 1
should_stop = False
for each in lines[1].split(" "):
	weights[i] = int(each)
	if int(each) > max_sum:
		should_stop = True
	i+=1
i = 2
tree = defaultdict(lambda:[])
if len(lines) == 3:
	for each in lines[2].split(" "):
		tree[int(each)].append(i)
		i+=1
if should_stop: 
	print -1
else:
	print minimum_decomposition(tree, weights, max_paths, max_sum)


	