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;
void getint(int &v) {
  char ch, fu = 0;
  for (ch = '*'; (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
    ;
  if (ch == '-') fu = 1, ch = getchar();
  for (v = 0; ch >= '0' && ch <= '9'; ch = getchar()) v = v * 10 + ch - '0';
  if (fu) v = -v;
}
const long long INF = 1e18 + 10;
long long mn[3000010], tag[3000010], S;
int f[500010], dep[500010], n, fa[500010], L, tot, ls[3000010], rs[3000010],
    rot[500010], a[500010], D, nedge, too[500010], hed[500010], nxt[500010];
void ae(int x, int y) {
  nxt[++nedge] = hed[x];
  hed[x] = nedge;
  too[nedge] = y;
}
void mkt(int x) {
  for (int i = hed[x]; i; i = nxt[i]) {
    int y = too[i];
    dep[y] = dep[x] + 1;
    mkt(y);
  }
}
int newnode() {
  tag[++tot] = 0;
  return tot;
}
void pushup(int rt) {
  mn[rt] = INF;
  if (ls[rt]) mn[rt] = min(mn[ls[rt]], mn[rt]);
  if (rs[rt]) mn[rt] = min(mn[rs[rt]], mn[rt]);
}
void TAG(int rt, int x) {
  mn[rt] += x;
  tag[rt] += x;
}
void pushdown(int rt) {
  if (tag[rt] != 0) {
    if (ls[rt]) TAG(ls[rt], tag[rt]);
    if (rs[rt]) TAG(rs[rt], tag[rt]);
    tag[rt] = 0;
  }
}
void ins(int l, int r, int &rt, int x, int y) {
  if (!rt) rt = newnode();
  if (l == r) {
    mn[rt] = y;
    return;
  }
  int m = l + r >> 1;
  if (x <= m)
    ins(l, m, ls[rt], x, y);
  else
    ins(m + 1, r, rs[rt], x, y);
  pushup(rt);
}
int mer(int l, int r, int x, int y) {
  if (x) pushdown(x);
  if (y) pushdown(y);
  if (!x || !y) return x + y;
  if (l == r) {
    mn[x] = min(mn[x], mn[y]);
    return x;
  }
  int m = l + r >> 1;
  ls[x] = mer(l, m, ls[x], ls[y]);
  rs[x] = mer(m + 1, r, rs[x], rs[y]);
  pushup(x);
  return x;
}
long long que(int l, int r, int rt, int L, int R) {
  if (!rt) return INF;
  if (L > R) return INF;
  if (l >= L && r <= R) return mn[rt];
  pushdown(rt);
  int m = l + r >> 1;
  long long t = INF;
  if (L <= m) t = min(t, que(l, m, ls[rt], L, R));
  if (R > m) t = min(t, que(m + 1, r, rs[rt], L, R));
  pushup(rt);
  return t;
}
void upd(int l, int r, int rt, int L, int R, int x) {
  if (!rt) return;
  if (L > R) return;
  if (l >= L && r <= R) {
    TAG(rt, x);
    return;
  }
  pushdown(rt);
  int m = l + r >> 1;
  if (L <= m) upd(l, m, ls[rt], L, R, x);
  if (R > m) upd(m + 1, r, rs[rt], L, R, x);
  pushup(rt);
}
void dfs(int x) {
  if (!hed[x]) {
    f[x] = 1;
    ins(1, D, rot[x], dep[x], a[x]);
    return;
  }
  int t = 0;
  for (int i = hed[x]; i; i = nxt[i]) {
    int y = too[i];
    dfs(y);
    f[x] += f[y];
    t = mer(1, D, t, rot[y]);
  }
  long long tmp = que(1, D, t, dep[x] + 1, min(D, dep[x] + L - 1));
  if (tmp <= S - a[x]) {
    upd(1, D, t, dep[x] + 1, min(D, dep[x] + L - 1), a[x]);
    rot[x] = t;
  } else {
    ++f[x];
    ins(1, D, rot[x], dep[x], a[x]);
  }
}
int main() {
  cin >> n >> L >> S;
  for (int i = 1; i <= n; ++i) {
    getint(a[i]);
    if (a[i] > S) return puts("-1"), 0;
  }
  for (int i = 2; i <= n; ++i) getint(fa[i]), ae(fa[i], i);
  dep[1] = 1;
  mkt(1);
  for (int i = 1; i <= n; ++i) D = max(D, dep[i]);
  dfs(1);
  cout << f[1] << endl;
  return 0;
}
