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>
const int N = 100005;
const long long inf = 2e18 + 10000;
using namespace std;
struct Node {
  int ans, L;
  long long w, b;
  list<pair<long long, int> > *v = nullptr;
  list<Node *> son;
  Node *ch = nullptr;
};
Node f[N];
int L0;
long long S0;
void dfs(Node *x) {
  if (x->son.empty()) {
    x->v = new list<pair<long long, int> >;
    x->v->push_back(make_pair(x->w, 1));
    x->ans = 1;
    x->L = 1, x->b = 0;
    return;
  }
  for (auto ip = x->son.begin(); ip != x->son.end(); ip++) {
    Node *y = *ip;
    dfs(y);
    x->ans += y->ans;
    if (x->L < y->L) x->L = y->L, x->ch = y;
  }
  if (x->ch->L == L0) {
    auto tp = x->ch->v->end();
    tp--;
    x->ch->L--;
    if (tp->second > 1)
      tp->second--;
    else
      x->ch->v->erase(tp);
  }
  int ba = x->ch->b;
  for (auto ip = x->son.begin(); ip != x->son.end(); ip++) {
    Node *y = *ip;
    if (y == x->ch) continue;
    int bb = y->b, L = min(y->L, L0 - 1);
    auto ap = x->ch->v->begin(), bp = y->v->begin();
    int i = 1, j = 1, k = 1;
    for (; i <= L; i++, j++, k++) {
      if (j > ap->second) ap++, j = 1;
      if (k > bp->second) bp++, k = 1;
      if (ap->first + ba > bp->first + bb) {
        long long W = bp->first + bb - ba;
        auto tp = ap++;
        if (j > 1) x->ch->v->insert(ap, make_pair(tp->first, j - 1));
        x->ch->v->insert(ap, make_pair(W, 1));
        if (j < tp->second)
          x->ch->v->insert(ap, make_pair(tp->first, tp->second - j)), ap--;
        x->ch->v->erase(tp);
        ap--;
        j = 1;
      }
    }
    long long W = ap->first;
    if (j > ap->second) ap++, j = 1;
    if (j > 1) continue;
    int cnt = 0;
    for (; ap != x->ch->v->end() && ap->first > W;) {
      cnt += ap->second;
      x->ch->v->erase(ap++);
    }
    if (cnt) x->ch->v->insert(ap, make_pair(W, cnt));
  }
  x->v = x->ch->v;
  x->v->push_front(make_pair(inf, 1));
  x->L = min(x->L + 1, L0);
  x->b = x->ch->b + x->w;
  auto tp = x->v->end();
  if ((--tp)->first + x->b > S0) {
    x->ans++;
    x->L = 1;
    x->b = 0;
    x->v = new list<pair<long long, int> >;
    x->v->push_back(make_pair(x->w, 1));
  }
}
int main() {
  int i, n;
  scanf("%d%d%lld", &n, &L0, &S0);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &f[i].w);
    if (f[i].w > S0) {
      puts("-1");
      return 0;
    }
  }
  if (L0 == 1) {
    cout << n << endl;
    return 0;
  }
  for (i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    f[x].son.push_back(f + i);
  }
  dfs(f + 1);
  cout << f[1].ans << endl;
  return 0;
}
