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.*;
import java.util.*;
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.flush();out.close();
    }
        static class TaskE {
            final int max=100010;
            final int mL=-2*max;
            final long mS=Long.MIN_VALUE/100;
           int n,L;long S;
           long w[];
           int start[]=new int[max];
           int end[]=new int[max];
           int euler[]=new int[max];
           int dp[]=new int[4*max];
           int ldp[]=new int[4*max];
           int ans[]=new int[max];
           int l[]=new int[4*max];
           long s[]=new long[4*max];
           int ll[]=new int[4*max];
           long ls[]=new long[4*max];
           ArrayList<Integer> remove=new ArrayList<>();
           int T=-1;
           
           void dfs(int u){
               start[u]=++T;euler[T]=u;
               for(int v:ja[u]){
                   dfs(v);
               }
               end[u]=T;
           }
           void cal(int u){
               int sum=0;
               for(int v:ja[u]){
                   cal(v);
                   sum+=ans[v];
               }
               remove.clear();
                lsupd(0,0,max-1,start[u],end[u],1,w[u]);
                // System.out.println(remove+" "+u);
                for(int i=0;i<remove.size();i++){
                    int node=remove.get(i);
                    lsupd(0,0,max-1,start[node],mL,mS);
                    dpupd(0,0,max-1,start[node],start[node],max,true);
                }
               for(int v:ja[u]){
                   dpupd(0,0,max-1,start[v],end[v],sum-ans[v],true);
               }
               dpupd(0,0,max-1,start[u],start[u],sum,false);
               ans[u]=1+dpquery(0,0,max-1,start[u],end[u]);
           }
           int dpquery(int n,int b,int e,int l,int r){
               dpupdlazy(n,b,e);
               if(l>e||r<b)return max;
               if(b>=l&&e<=r){
                   return dp[n];
               }
               int m=(b+e)>>1;
               return Math.min(dpquery(2*n+1,b,m,l,r),dpquery(2*n+2,m+1,e,l,r));
           }
           void dpupdlazy(int n,int b,int e){
               if(ldp[n]==0)return;
               dp[n]+=ldp[n];
               if(b!=e){
                   ldp[2*n+1]+=ldp[n];
                   ldp[2*n+2]+=ldp[n];
               }
               ldp[n]=0;
           }
           void dpupdn(int n){
               dp[n]=Math.min(dp[2*n+1],dp[2*n+2]);
           }
           void dpupd(int n,int b,int e,int l,int r,int val,boolean inc){
               dpupdlazy(n,b,e);
               if(l>e||r<b)return;
               if(b>=l&&e<=r){
                   if(inc){
                    ldp[n]+=val;
                    dpupdlazy(n,b,e);
                   }else{
                       dp[n]=val;
                   }
                   return;
               }
               int m=(b+e)>>1;
               dpupd(2*n+1,b,m,l,r,val,inc);
               dpupd(2*n+2,m+1,e,l,r,val,inc);
               dpupdn(n);
           }
           void lsupdlazy(int n,int b,int e){
               if(ll[n]==0&&ls[n]==0)return;
               l[n]+=ll[n];s[n]+=ls[n];
               if(b!=e){
                   ll[2*n+1]+=ll[n];ls[2*n+1]+=ls[n];
                   ll[2*n+2]+=ll[n];ls[2*n+2]+=ls[n];
               }
               ll[n]=0;ls[n]=0;
           }
           void lsupd(int n,int b,int e,int id,int la,long sa){
               lsupdlazy(n,b,e);
               if(id>e||id<b){
                   return;
               }
               if(b==e){
                   l[n]+=la;s[n]+=sa;
                   return;
               }
               int m=(b+e)>>1;
               lsupd(2*n+1,b,m,id,la,sa);
               lsupd(2*n+2,m+1,e,id,la,sa);
               lsupdn(n);
           }
           void lsupdn(int n){
               l[n]=Math.max(l[2*n+1],l[2*n+2]);
               s[n]=Math.max(s[2*n+1],s[2*n+2]);
           }
           void lsupd(int n,int b,int e,int ql,int qr,int add,long val){
               lsupdlazy(n,b,e);
               if(ql>e||qr<b)return;
               if(b>=ql&&e<=qr){
                   ll[n]+=add;ls[n]+=val;
                    lsupdlazy(n,b,e);
                    // System.out.println(b+" "+e+" "+n+" "+l[n]+" "+s[n]+" top");
                   if(!(l[n]>L||s[n]>S)){
                       return;
                   }add=0;val=0;
               }
               if(b==e){
                   int u=euler[b];long v=s[n];int len=l[n];
                //   System.out.println(u+" "+v+" "+len+" "+ql+" "+qr);
                    while(len>L||v>S){
                        remove.add(u);
                        v-=w[u];len--;
                        u=pa[u];
                    }
                    return;
               }
               int m=(b+e)>>1;
               lsupd(2*n+1,b,m,ql,qr,add,val);
               lsupd(2*n+2,m+1,e,ql,qr,add,val);
               lsupdn(n);
           }
           public void solve(int testNumber, InputReader in, PrintWriter out) {
            n=in.nextInt();L=in.nextInt();S=in.nextLong();
            w=new long[n+1];
            for(int i=1;i<=n;i++){
                w[i]=in.nextLong();
                if(w[i]>S){
                    out.print(-1);return;
                }
            }
            make(n,n-1,in);
            dfs(1); 
            cal(1);
            // for(int i=1;i<=n;i++)System.out.print(ans[i]+" ");
            out.print(ans[1]);
          }
            int ja[][];int from[],to[],c[],pa[];
            void make(int n,int m,InputReader in){
             ja=new int[n+1][];from=new int[m];to=new int[m];c=new int[n+1];
             pa=new int[n+1];
             for(int i=0;i<m;i++){
              from[i]=in.nextInt();to[i]=i+2;pa[i+2]=from[i];
              c[from[i]]++;
             }
             for(int i=0;i<=n;i++){
              ja[i]=new int[c[i]];c[i]=0;
             }
             for(int i=0;i<m;i++){
              ja[from[i]][c[from[i]]++]=to[i];
             }
            }
//        int[] radixSort(int[] f){ return radixSort(f, f.length); }
//    int[] radixSort(int[] f, int n)
//    {
//        int[] to = new int[n];
//        {
//            int[] b = new int[65537];
//            for(int i = 0;i < n;i++)b[1+(f[i]&0xffff)]++;
//            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
//            for(int i = 0;i < n;i++)to[b[f[i]&0xffff]++] = f[i];
//            int[] d = f; f = to;to = d;
//        }
//        {
//            int[] b = new int[65537];
//            for(int i = 0;i < n;i++)b[1+(f[i]>>>16)]++;
//            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
//            for(int i = 0;i < n;i++)to[b[f[i]>>>16]++] = f[i];
//            int[] d = f; f = to;to = d;
//        }
//        return f;
//    }
    }
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;
        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}