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;
vector<int> g[100111];
int f[100111][18];
int sz[100111], son[100111], depth[100111];
int id[100111], rid[100111], top[100111];
int upmost[100111], L;
long long sm[100111][18];
long long wt[100111];
long long S;
int n, cnt = 0;
int tree[100111 << 2];
void dfs1(int v, int pre) {
  f[v][0] = pre;
  sm[v][0] = wt[pre];
  depth[v] = depth[pre] + 1;
  sz[v] = 1;
  int max_subsz = 0, i;
  for (i = 1; i <= 17; ++i) {
    f[v][i] = f[f[v][i - 1]][i - 1];
    sm[v][i] = sm[f[v][i - 1]][i - 1] + sm[v][i - 1];
  }
  for (auto nv : g[v]) {
    if (nv != pre) {
      dfs1(nv, v);
      sz[v] += sz[nv];
      if (max_subsz < sz[nv]) {
        son[v] = nv, max_subsz = sz[nv];
      }
    }
  }
}
void dfs2(int v, int tp) {
  top[v] = tp, id[v] = ++cnt, rid[id[v]] = v;
  if (son[v]) {
    dfs2(son[v], tp);
  }
  for (auto nv : g[v]) {
    if (nv != f[v][0] && nv != son[v]) {
      dfs2(nv, nv);
    }
  }
}
int find(int v) {
  long long curr = wt[v];
  int tol = 1, i;
  for (i = 17; i >= 0; --i) {
    if (tol + (1 << i) <= L && curr + sm[v][i] <= S && f[v][i] != 0) {
      tol = tol + (1 << i);
      curr = curr + sm[v][i];
      v = f[v][i];
    }
  }
  return v;
}
void pushdown(int l, int r, int index) {
  if (l >= r) return;
  if (tree[index] == 1) {
    tree[(index << 1)] = tree[index];
    tree[(index << 1 | 1)] = tree[index];
    tree[index] = 0;
  }
}
void update(int start, int end, int l, int r, int index) {
  if (start > end || l > r || start > r || l > end) return;
  pushdown(l, r, index);
  if (start <= l && r <= end) {
    tree[index] = 1;
    return;
  }
  if (end <= ((l + r) >> 1)) {
    update(start, end, l, ((l + r) >> 1), (index << 1));
  } else if (start >= ((l + r) >> 1) + 1) {
    update(start, end, ((l + r) >> 1) + 1, r, (index << 1 | 1));
  } else {
    update(start, end, l, ((l + r) >> 1), (index << 1));
    update(start, end, ((l + r) >> 1) + 1, r, (index << 1 | 1));
  }
}
int query(int pt, int l, int r, int index) {
  if (l > r || pt < l || pt > r) return 0;
  pushdown(l, r, index);
  if (pt == l && l == r) {
    return tree[index];
  }
  if (pt <= ((l + r) >> 1)) return query(pt, l, ((l + r) >> 1), (index << 1));
  return query(pt, ((l + r) >> 1) + 1, r, (index << 1 | 1));
}
void hld(int x, int y) {
  int fx = top[x], fy = top[y];
  while (fx != fy) {
    if (depth[fx] >= depth[fy]) {
      update(id[fx], id[x], 1, n, 1);
      x = f[fx][0], fx = top[x];
    } else {
      update(id[fy], id[y], 1, n, 1);
      y = f[fy][0], fy = top[y];
    }
  }
  if (id[x] <= id[y]) {
    update(id[x], id[y], 1, n, 1);
  } else {
    update(id[y], id[x], 1, n, 1);
  }
}
int main() {
  scanf("%d%d%I64d", &n, &L, &S);
  int i;
  for (i = 1; i <= n; ++i) {
    scanf("%I64d", &wt[i]);
    if (wt[i] > S) {
      printf("-1\n");
      return 0;
    }
  }
  for (i = 2; i <= n; ++i) {
    int v;
    scanf("%d", &v);
    g[v].push_back(i);
  }
  dfs1(1, 0);
  dfs2(1, 1);
  for (i = 1; i <= n; ++i) {
    upmost[i] = find(i);
  }
  int ans = 0;
  for (i = n; i >= 1; --i) {
    if (!query(id[i], 1, n, 1)) {
      ans++;
      hld(i, upmost[i]);
    }
  }
  printf("%d\n", ans);
  return 0;
}
