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;
int head[100010], nxt[100010], a[100010], edge, n, l, tag1[100010], f[100010],
    value[100010];
long long s, tag2[100010];
pair<int, long long> c1[100010], c2[100010];
set<pair<int, long long> > S[100010];
void create(int u, int v) {
  edge++;
  a[edge] = v;
  nxt[edge] = head[u];
  head[u] = edge;
}
void merge(int u, int v) {
  int tot1 = 0, tot2 = 0, flag = 0;
  if (S[u].size() < S[v].size()) {
    flag = 1;
    swap(u, v);
  }
  for (set<pair<int, long long> >::iterator it = S[v].begin(); it != S[v].end();
       it++) {
    pair<int, long long> now = *it;
    now.first = now.first + tag1[v] - tag1[u];
    now.second = now.second + tag2[v] - tag2[u];
    set<pair<int, long long> >::iterator cur =
        S[u].lower_bound(make_pair(now.first, -1e18));
    if (cur == S[u].end() || (*cur).first != now.first)
      c2[++tot2] = now;
    else if (now.second < (*cur).second) {
      c1[++tot1] = (*cur);
      c2[++tot2] = now;
    }
  }
  for (int i = 1; i <= tot1; i++) S[u].erase(c1[i]);
  for (int i = 1; i <= tot2; i++) S[u].insert(c2[i]);
  if (flag) {
    swap(S[u], S[v]);
    swap(tag1[u], tag1[v]);
    swap(tag2[u], tag2[v]);
  }
}
void dfs(int u) {
  for (int i = head[u]; i; i = nxt[i]) {
    int v = a[i];
    dfs(v);
    merge(u, v);
    f[u] += f[v];
  }
  set<pair<int, long long> >::iterator it;
  while (S[u].empty() == false) {
    it = S[u].end();
    it--;
    pair<int, long long> now = *it;
    now.first += tag1[u] + 1;
    now.second += tag2[u] + value[u];
    if (now.second > s || now.first > l)
      S[u].erase(it);
    else
      break;
  }
  if (S[u].empty()) {
    f[u]++;
    tag1[u] = tag2[u] = 0;
    S[u].insert(make_pair(1, value[u]));
  } else {
    tag1[u]++;
    tag2[u] += value[u];
  }
}
int main() {
  scanf("%d%d%I64d", &n, &l, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &value[i]);
    if (value[i] > s) {
      puts("-1");
      return 0;
    }
  }
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    create(x, i);
  }
  dfs(1);
  printf("%d\n", f[1]);
  return 0;
}
