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;
const int N = 1e5 + 10;
const long long inf = 1e14;
struct edge {
  int nxt, to;
} e[N << 1];
int head[N], pos, n, L, dep[N], anc[N][20], siz[N], dfn[N], dfscnt, rnk[N];
void add(int u, int v) {
  e[++pos] = (edge){head[u], v};
  head[u] = pos;
}
long long S, w[N], sum[N];
void dfs(int u, int fa) {
  dep[u] = dep[fa] + 1;
  int i;
  dfn[u] = ++dfscnt;
  rnk[dfscnt] = u;
  siz[u] = 1;
  for (i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    if (v == fa) continue;
    sum[v] = sum[u] + w[v];
    dfs(v, u);
    anc[v][0] = u;
    siz[u] += siz[v];
  }
}
long long seg[N << 2], tag[N << 2];
long long mmin(long long x, long long y) { return x > y ? y : x; }
void pushdown(int rt) {
  if (tag[rt]) {
    tag[rt << 1] += tag[rt];
    tag[rt << 1 | 1] += tag[rt];
    seg[rt << 1] += tag[rt];
    seg[rt << 1 | 1] += tag[rt];
    tag[rt];
  }
}
void pushup(int rt) { seg[rt] = mmin(seg[rt << 1], seg[rt << 1 | 1]); }
void mty(int rt, int l, int r, int k, long long d) {
  if (l == r) {
    seg[rt] = d;
    return;
  }
  int mid = l + r >> 1;
  pushdown(rt);
  if (mid >= k)
    mty(rt << 1, l, mid, k, d);
  else
    mty(rt << 1 | 1, mid + 1, r, k, d);
  pushup(rt);
}
void motify(int rt, int l, int r, int ql, int qr, long long k) {
  if (ql <= l && r <= qr) {
    seg[rt] += k;
    tag[rt] += k;
    return;
  }
  int mid = l + r >> 1;
  pushdown(rt);
  if (mid >= ql) motify(rt << 1, l, mid, ql, qr, k);
  if (mid + 1 <= qr) motify(rt << 1 | 1, mid + 1, r, ql, qr, k);
  pushup(rt);
}
long long query(int rt, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) return seg[rt];
  int mid = l + r >> 1;
  long long res = inf;
  pushdown(rt);
  if (mid >= ql) res = mmin(res, query(rt << 1, l, mid, ql, qr));
  if (mid + 1 <= qr) res = mmin(res, query(rt << 1 | 1, mid + 1, r, ql, qr));
  pushup(rt);
  return res;
}
vector<int> ed[N];
int f[N], sig[N];
void dfs2(int u, int fa) {
  int i;
  f[u] = 1 << 30;
  for (i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    if (v == fa) continue;
    dfs2(v, u);
    sig[u] += f[v];
  }
  for (i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    if (v == fa) continue;
    motify(1, 1, n, dfn[v], dfn[v] + siz[v] - 1, sig[u] - f[v]);
  }
  f[u] = query(1, 1, n, dfn[u] + 1, dfn[u] + siz[u] - 1) + 1;
  f[u] = mmin(f[u], sig[u] + 1);
  mty(1, 1, n, dfn[u], sig[u]);
  int x = u;
  for (i = 19; i >= 0; --i)
    if (anc[x][i] && sum[u] - sum[anc[x][i]] + w[anc[x][i]] <= S &&
        dep[u] - dep[anc[x][i]] + 1 <= L)
      x = anc[x][i];
  ed[x].push_back(u);
  vector<int>::iterator it;
  for (it = ed[u].begin(); it != ed[u].end(); ++it) {
    mty(1, 1, n, dfn[*it], inf);
  }
}
int main() {
  scanf("%d%d%I64d", &n, &L, &S);
  int i, j;
  for (i = 1; i <= n; ++i) scanf("%I64d", &w[i]);
  for (i = 1; i <= n; ++i)
    if (w[i] > S) {
      printf("-1");
      return 0;
    }
  for (i = 2; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    add(i, x);
    add(x, i);
  }
  sum[1] = w[1];
  dfs(1, 0);
  for (j = 1; j <= 19; ++j)
    for (i = 1; i <= n; ++i) anc[i][j] = anc[anc[i][j - 1]][j - 1];
  for (i = 0; i <= (4e5) + 5; ++i) seg[i] = inf;
  dfs2(1, 0);
  cout << f[1];
}
