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;
struct P {
  int s, e;
  vector<int> v;
  long long int dp, dp_sum;
} V[100010];
long long int w[100010];
vector<int> adj[100010];
int cnt = 0;
int n, L;
long long int S, lift[100010][20];
long long int cumm[100010];
void dfs(int cur, int prev = -1) {
  if (prev == -1)
    cumm[cur] = w[cur];
  else
    cumm[cur] = cumm[prev] + w[cur];
  V[cur].s = cnt;
  cnt++;
  lift[cur][0] = prev;
  for (int i = 1; i < 20; i++)
    lift[cur][i] =
        (lift[cur][i - 1] == -1 ? -1 : lift[lift[cur][i - 1]][i - 1]);
  int dist = L - 1;
  int pp = cur;
  for (int i = 20 - 1; i >= 0; i--) {
    if (lift[pp][i] == -1 || (1 << i) > dist) continue;
    long long int temp = cumm[cur] - cumm[lift[pp][i]] + w[lift[pp][i]];
    if (temp <= S) {
      dist -= (1 << i);
      pp = lift[pp][i];
    }
  }
  V[pp].v.push_back(cur);
  for (int u : adj[cur]) {
    if (u == prev) continue;
    dfs(u, cur);
  }
  V[cur].e = cnt - 1;
}
long long int tree[4 * 100010] = {}, lazy[4 * 100010] = {};
const long long int inf = 1e18;
void build(int node, int start, int end) {
  tree[node] = inf;
  if (start == end)
    return;
  else {
    int mid = (start + end) >> 1;
    build(2 * node, start, mid);
    build(2 * node + 1, mid + 1, end);
  }
}
void update_node(int node, int start, int end, int idx, long long int val) {
  if (start == end)
    tree[node] = val;
  else {
    tree[2 * node] += lazy[node];
    tree[2 * node + 1] += lazy[node];
    lazy[2 * node] += lazy[node];
    lazy[2 * node + 1] += lazy[node];
    lazy[node] = 0;
    int mid = (start + end) >> 1;
    if (idx <= mid)
      update_node(2 * node, start, mid, idx, val);
    else
      update_node(2 * node + 1, mid + 1, end, idx, val);
    tree[node] = min(tree[2 * node], tree[2 * node + 1]);
  }
}
void update_range(int node, int start, int end, int l, int r,
                  long long int val) {
  if (start >= l && end <= r) {
    tree[node] += val;
    lazy[node] += val;
    return;
  }
  tree[2 * node] += lazy[node];
  tree[2 * node + 1] += lazy[node];
  lazy[2 * node] += lazy[node];
  lazy[2 * node + 1] += lazy[node];
  lazy[node] = 0;
  int mid = (start + end) >> 1;
  if (mid >= r) {
    update_range(2 * node, start, mid, l, r, val);
    tree[node] = min(tree[2 * node], tree[2 * node + 1]);
    return;
  }
  if (mid < l) {
    update_range(2 * node + 1, mid + 1, end, l, r, val);
    tree[node] = min(tree[2 * node], tree[2 * node + 1]);
    return;
  }
  update_range(2 * node, start, mid, l, r, val);
  update_range(2 * node + 1, mid + 1, end, l, r, val);
  tree[node] = min(tree[2 * node], tree[2 * node + 1]);
}
long long int query(int node, int start, int end, int l, int r) {
  if (start >= l && end <= r) return tree[node];
  if (start != end) {
    tree[2 * node] += lazy[node];
    tree[2 * node + 1] += lazy[node];
    lazy[2 * node] += lazy[node];
    lazy[2 * node + 1] += lazy[node];
    lazy[node] = 0;
  }
  lazy[node] = 0;
  int mid = (start + end) >> 1;
  if (mid >= r) return query(2 * node, start, mid, l, r);
  if (mid < l) return query(2 * node + 1, mid + 1, end, l, r);
  long long int P1 = query(2 * node, start, mid, l, r);
  long long int P2 = query(2 * node + 1, mid + 1, end, l, r);
  return min(P1, P2);
}
void solve(int cur, int par = -1) {
  V[cur].dp = 0;
  V[cur].dp_sum = 0;
  for (int u : adj[cur]) {
    if (u == par) continue;
    solve(u, cur);
    V[cur].dp_sum += V[u].dp;
  }
  update_node(1, 0, cnt - 1, V[cur].s, 0);
  update_range(1, 0, cnt - 1, V[cur].s, V[cur].e, V[cur].dp_sum);
  V[cur].dp = query(1, 0, n - 1, V[cur].s, V[cur].e) + 1;
  update_range(1, 0, n - 1, V[cur].s, V[cur].e, -V[cur].dp);
  for (int u : V[cur].v) update_node(1, 0, n - 1, V[u].s, inf);
  return;
}
int main() {
  scanf("%d %d %lld", &n, &L, &S);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &w[i]);
    if (w[i] > S) {
      printf("-1\n");
      return 0;
    }
  }
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    adj[x].push_back(i);
    adj[i].push_back(x);
  }
  dfs(1);
  build(1, 0, n - 1);
  solve(1);
  printf("%lld\n", V[1].dp);
  return 0;
}
