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.
#include <bits/stdc++.h>
using namespace std;
long long int n, L, S, w[100010], sum[100010], dp[100010], N, lazy[8 * 100010],
    t[8 * 100010];
int LOGL;
int p[100010], tin[100010], tout[100010], P[100010][20], tim;
vector<int> adj[100010], maxup[100010];
void calcP() {
  memset(P, -1, sizeof(P));
  for (int u = 1; u < n; u++) {
    P[u][0] = p[u];
  }
  for (int k = 1; k <= 20; k++) {
    for (int u = 0; u < n; u++) {
      if (P[u][k - 1] != -1) {
        P[u][k] = P[P[u][k - 1]][k - 1];
      }
    }
  }
  LOGL = 0;
  long long int p2 = 1LL;
  while (1) {
    if (2LL * p2 <= L - 1) {
      p2 *= 2LL;
      LOGL++;
    } else {
      break;
    }
  }
}
void precalc(int u) {
  tin[u] = tim++;
  int tam = adj[u].size();
  sum[u] = w[u] + ((u == 0) ? 0 : sum[p[u]]);
  for (int i = 0; i < tam; i++) {
    int v = adj[u][i];
    precalc(v);
  }
  int uu = u;
  long long int SS = S;
  for (int k = 20; k >= 0; k--) {
    if (P[uu][k] == -1) {
      continue;
    }
    if (sum[u] - ((P[uu][k] == 0) ? 0 : sum[p[P[uu][k]]]) <= SS) {
      uu = P[uu][k];
    }
  }
  long long int d = L - 1;
  int uuu = u, k = 0;
  while (d > 0) {
    if (d % 2) {
      uuu = P[uuu][k];
    }
    d /= 2;
    k++;
  }
  if (uuu == -1) {
    uuu = 0;
  }
  if (uu == -1) {
    uu = 0;
  }
  if (tin[uuu] <= tin[uu]) {
    maxup[uu].push_back(u);
  } else {
    maxup[uuu].push_back(u);
  }
  tout[u] = tim++;
}
void create() {
  memset(lazy, 0, sizeof(lazy));
  memset(t, 0, sizeof(t));
}
void refresh(int node, int L, int R) {
  t[node] += lazy[node];
  int nl = 2 * node, nr = 2 * node + 1;
  lazy[nl] += lazy[node];
  lazy[nr] += lazy[node];
  lazy[node] = 0;
}
long long int lazyValue(int node) { return t[node] + lazy[node]; }
long long int st_query(int node, int L, int R, int i, int j) {
  if (i <= L && R <= j) {
    return lazyValue(node);
  }
  if (R < i || j < L) {
    return 1e9;
  }
  if (lazy[node]) {
    refresh(node, L, R);
  }
  int nl = 2 * node, nr = 2 * node + 1;
  long long int al = st_query(nl, L, (L + R) / 2, i, j);
  long long int ar = st_query(nr, (L + R) / 2 + 1, R, i, j);
  return min(al, ar);
}
long long int st_query(int i, int j) { return st_query(1, 0, N - 1, i, j); }
void st_update(int node, int L, int R, int i, int j, long long int val) {
  if (i <= L && R <= j) {
    lazy[node] += val;
    return;
  }
  if (R < i || j < L) {
    return;
  }
  if (lazy[node]) {
    refresh(node, L, R);
  }
  int nl = 2 * node, nr = 2 * node + 1;
  st_update(nl, L, (L + R) / 2, i, j, val);
  st_update(nr, (L + R) / 2 + 1, R, i, j, val);
  t[node] = min(lazyValue(nl), lazyValue(nr));
}
void st_update(int i, int j, long long int val) {
  st_update(1, 0, N - 1, i, j, val);
}
void solve(int u) {
  int tam = adj[u].size();
  long long int sum = 0;
  for (int i = 0; i < tam; i++) {
    int v = adj[u][i];
    solve(v);
    sum += dp[v];
  }
  dp[u] = 1 + sum + st_query(tin[u], tout[u]);
  st_update(tin[u], tout[u], sum - dp[u]);
  tam = maxup[u].size();
  for (int i = 0; i < tam; i++) {
    int v = maxup[u][i];
    st_update(tin[v], tin[v], 1e9);
    st_update(tout[v], tout[v], 1e9);
  }
}
int main() {
  while (scanf("%lld %lld %lld", &n, &L, &S) != EOF) {
    int pos = true;
    for (int i = 0; i < n; i++) {
      scanf("%lld", &w[i]);
      if (w[i] > S) {
        pos = false;
      }
      adj[i].clear();
      maxup[i].clear();
    }
    for (int i = 2; i <= n; i++) {
      int v = (i - 1);
      scanf("%d", &p[v]);
      p[v]--;
      adj[p[v]].push_back(v);
    }
    if (!pos) {
      printf("-1\n");
      continue;
    }
    if (L == 1) {
      printf("%lld\n", n);
      continue;
    }
    tim = 0;
    N = 2 * n;
    calcP();
    precalc(0);
    create();
    solve(0);
    printf("%lld\n", dp[0]);
  }
  return 0;
}
