Problem: You are given a rooted tree on vertices, its root is the vertex number . The -th vertex contains a number . Split it into the minimum possible number of vertical paths in such a way that each path contains no more than vertices and the sum of integers on each path does not exceed . Each vertex should belong to exactly one path.
A vertical path is a sequence of vertices where () is the parent of .
Input Format: The first line contains three integers , , (, , ) — the number of vertices, the maximum number of vertices in one path and the maximum sum in one path.
The second line contains integers () — the numbers in the vertices of the tree.
The third line contains integers (), where is the parent of the -th vertex in the tree.
Output Format: Output one number — the minimum number of vertical paths. If it is impossible to split the tree, output .
Note: In the first sample the tree is split into .
In the second sample the tree is split into or .
In the third sample it is impossible to split the tree.