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.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;

public class E1059 {
	static int N, L;
	static long S;
	static BL b;
	static int[] len, pcount;
	static long[] psum, w;
	static ArrayList<Integer>[] adj;
	public static void main(String[] args) {
		JS scan = new JS();
		N = scan.nextInt();
		L = scan.nextInt();
		S = scan.nextLong();
		
		w = new long[N];
		for(int i=0;i<N;i++)w[i] = scan.nextLong();
		
		for(int i=0;i<N;i++) {
			if(w[i] > S) {
				System.out.println(-1);
				return;
			}
		}
		
		adj = new ArrayList[N];
		int[] par = new int[N];
		par[0] = -1;
		for(int i=0;i<N;i++)adj[i] = new ArrayList<>();
		for(int i=1;i<N;i++) {
			par[i] = scan.nextInt()-1;
			adj[par[i]].add(i);
		}
		
		b = new BL(par,w);
		
		len = new int[N];
		psum = new long[N];
		pcount = new int[N];
		solve(0);
		System.out.println(pcount[0]);
	}
	
	private static void solve(int idx) {
		if(adj[idx].size() == 0) {
			len[idx] = 1;
			pcount[idx] = 1;
			psum[idx] = w[idx];
			return;
		}
		
		for(int i : adj[idx]) {
			solve(i);
		}
		
		int best = 0, bestIdx = -1;
		for(int i : adj[idx]) {
			pcount[idx] += pcount[i];
			if(len[i] == L)continue;
			int tmp = b.getMaxSumAbove(i, S-psum[i]);
			tmp = Math.min(L-len[i], tmp);
			if(tmp > best) {
				best = tmp;
				bestIdx = i;
			}
		}
		if(bestIdx != -1) {
			psum[idx] = psum[bestIdx]+w[idx];
			len[idx] = len[bestIdx]+1;
		} else {
			pcount[idx]++;
			psum[idx] = w[idx];
			len[idx] = 1;
		}
	}

	private static class BL {
		int N, LOG;
		int[][] table;
		long[][] sum;
		int[] h;
		long[] vals;
		public BL(int[] par, long[] vals) {
			N = par.length;
			LOG = Math.max(1,(int)Math.ceil(Math.log(N)/Math.log(2.0)));
			table = new int[LOG][N];
			sum = new long[LOG][N];
			h = new int[N];
			for(int i=0;i<N;i++)genH(i, par);
			this.vals = vals;
			genTable(par);
		}
		private int genH(int idx, int[] par) {
			if(h[idx]!=0)return h[idx];
			if(par[idx]==-1)return h[idx] = 1;
			return h[idx] = 1+genH(par[idx],par);
		}
		private void genTable(int[] par) {
			table[0] = par;
			for(int i=0;i<N;i++)sum[0][i] = par[i] == -1 ? 0 : vals[par[i]];
			for(int i=1;i<LOG;i++){
				for(int j=0;j<N;j++){
					table[i][j] = (table[i-1][j]==-1)?-1:table[i-1][table[i-1][j]];
					sum[i][j] = sum[i-1][j]+(table[i-1][j] == -1 ? 0 : sum[i-1][table[i-1][j]]);
				}
			}
		}
		private int getMaxSumAbove(int v, long cap) {
			int count = 0;
			for(int i=LOG-1;i>=0;i--) {
				if(table[i][v]!=-1 && sum[i][v]<=cap) {
					count+=(1<<i);
					cap-=sum[i][v];
					v = table[i][v];
				}
			}
			return count;
		}
		private int lca (int v, int u){
			if(h[v] < h[u]){
				int t = v; v=u;u=t;
			}
			for(int i=LOG-1;i>=0;i--)
				if(table[i][v]!=-1 && h[table[i][v]]>=h[u])
					v = table[i][v];
			if(v==u)return v;
			for(int i=LOG-1;i>=0;i--)
				if(table[i][v]-table[i][u]!=0){
					v = table[i][v]; u = table[i][u];
				}
			return table[0][v];
		}
	}
	
	private static class JS {
	        public int BS = 1<<16;
	        public char NC = (char)0;
	        byte[] buf = new byte[BS];
	        int bId = 0, size = 0;
	        char c = NC;
	        double num = 1;
	        BufferedInputStream in;

	        public JS() {
	            in = new BufferedInputStream(System.in, BS);
	        }

	        public JS(String s) throws FileNotFoundException {
	            in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
	        }

	        public char nextChar(){
	            while(bId==size) {
	                try {
	                    size = in.read(buf);
	                }catch(Exception e) {
	                    return NC;
	                }
	                if(size==-1)return NC;
	                bId=0;
	            }
	            return (char)buf[bId++];
	        }

	        public int nextInt() {
	            return (int)nextLong();
	        }

	        public long nextLong() {
	            num=1;
	            boolean neg = false;
	            if(c==NC)c=nextChar();
	            for(;(c<'0' || c>'9'); c = nextChar()) {
	                if(c=='-')neg=true;
	            }
	            long res = 0;
	            for(; c>='0' && c <='9'; c=nextChar()) {
	                res = (res<<3)+(res<<1)+c-'0';
	                num*=10;
	            }
	            return neg?-res:res;
	        }

	        public double nextDouble() {
	            double cur = nextLong();
	            return c!='.' ? cur:cur+nextLong()/num;
	        }

	        public String next() {
	            StringBuilder res = new StringBuilder();
	            while(c<=32)c=nextChar();
	            while(c>32) {
	                res.append(c);
	                c=nextChar();
	            }
	            return res.toString();
	        }

	        public String nextLine() {
	            StringBuilder res = new StringBuilder();
	            while(c<=32)c=nextChar();
	            while(c!='\n') {
	                res.append(c);
	                c=nextChar();
	            }
	            return res.toString();
	        }

	        public boolean hasNext() {
	            if(c>32)return true;
	            while(true) {
	                c=nextChar();
	                if(c==NC)return false;
	                else if(c>32)return true;
	            }
	        }
	    }
}
