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.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author beginner1010
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        final int LOGN = 20;
        ArrayList<Integer>[] adj;
        int[] depth;
        int res;

        void findDepth(int node, int curDepth) {
            depth[node] = curDepth;
            for (int child : adj[node]) {
                findDepth(child, curDepth + 1);
            }
        }

        int dfs(int node, long[][] dpSum, int[][] dpParent, int L, long S) {
            int covered = 0;
            int bestAt = -1;
            for (int child : adj[node]) {
                int ancestor = dfs(child, dpSum, dpParent, L, S);
                if (depth[ancestor] < depth[node]) {
                    covered = 1;
                }
                if (bestAt == -1 || depth[ancestor] < depth[bestAt]) {
                    bestAt = ancestor;
                }
            }
            if (covered == 0) {
                res++;
                int curL = L;
                long curS = S;
                bestAt = node;
                for (int j = LOGN - 1; j >= 0; j--) {
                    if ((1 << j) <= curL && dpSum[j][bestAt] <= curS) {
                        curS -= dpSum[j][bestAt];
                        curL -= (1 << j);
                        bestAt = dpParent[j][bestAt];
                    }
                }
            }
            return bestAt;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt() + 1;
            int L = in.nextInt();
            long S = in.nextLong();
            long[] w = new long[n];
            for (int i = 1; i < n; i++) {
                w[i] = in.nextLong();
                if (w[i] > S) {
                    out.println(-1);
                    return;
                }
            }

            adj = new ArrayList[n];
            for (int i = 0; i < n; i++) {
                adj[i] = new ArrayList<>();
            }

            int[] parent = new int[n];
            for (int i = 2; i < n; i++) {
                parent[i] = in.nextInt();
                adj[parent[i]].add(i);
            }

            long[][] dpSum = new long[LOGN][n + 1];
            int[][] dpParent = new int[LOGN][n + 1];
            for (int i = 1; i < n; i++) {
                dpSum[0][i] = w[i];
                dpParent[0][i] = parent[i];
            }
            for (int j = 1; j < LOGN; j++) {
                for (int i = 0; i < n; i++) {
                    dpParent[j][i] = dpParent[j - 1][dpParent[j - 1][i]];
                    dpSum[j][i] = dpSum[j - 1][i] + dpSum[j - 1][dpParent[j - 1][i]];
                }
            }

            depth = new int[n];
            findDepth(1, 1);
            res = 0;
            dfs(1, dpSum, dpParent, L, S);
            out.println(res);
        }

    }

    static class InputReader {
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputStream stream;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        private boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isWhitespace(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isWhitespace(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sgn;
        }

    }
}

