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;
long long height[100001], wait[100001], vis[100001], result, cd, length, s,
    w[100001][18], dad[100001][18], p[18], h[100001], u, kq = 1;
vector<long long> edge[100001];
priority_queue<pair<long long, pair<long long, long long>>> pq;
void dfs(long long e, long long i) {
  h[1] = p[0] = 1;
  p[i] = p[i - 1] * 2;
  dad[e][i] = dad[dad[dad[e][i - 1]][1]][i - 1];
  w[e][i] = w[e][i - 1] + w[dad[dad[e][i - 1]][1]][i - 1];
  for (auto v : edge[e]) h[v] = h[e] + 1, dfs(v, i);
}
long long get(long long u, long long h) {
  long long s = 0;
  for (long long i = 17; i >= 0; i--)
    if (h - p[i] >= 0) h -= p[i], s += w[u][i], u = dad[dad[u][i]][1];
  return s;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> cd >> length >> s;
  for (long long i = 1; i <= cd; i++) cin >> w[i][0], dad[i][0] = i;
  for (long long i = 2; i <= cd; i++)
    cin >> dad[i][1], edge[dad[i][1]].push_back(i), wait[dad[i][1]]++;
  for (long long i = 1; i <= 17; i++) dfs(1, i);
  for (long long i = 1; i <= cd; i++) {
    long long l = 1, r = min(length, h[i]);
    while (r >= l) {
      long long mid = (l + r) / 2;
      if (get(i, mid) > s)
        r = mid - 1;
      else
        height[i] = mid, l = mid + 1;
    }
    if (height[i] == 0) {
      cout << -1;
      exit(0);
    }
    if (s == 1000000000000000000 && length == 1 && height[i] != 1)
      cout << "CO" << endl;
  }
  long long CONST = 1e7, mx = 0;
  for (long long i = 1; i <= cd; i++)
    if (edge[i].size() == 0)
      pq.push(pair<long long, pair<long long, long long>>(
          -1, make_pair(CONST - (h[i] - height[i]), i)));
  vis[0] = 1;
  while (pq.size() != 0) {
    result++;
    long long node = pq.top().second.second;
    int ok = 0;
    long long u = node;
    vis[u] = 1;
    for (long long i = 1; i <= height[node]; i++) {
      u = dad[u][1];
      if (vis[u] == 1) {
        ok = 1;
        pq.pop();
        break;
      }
      if (i == height[node]) {
        wait[u]--;
        if (wait[u] == 0) {
          int t = pq.top().first;
          ok = 1;
          pq.pop();
          pq.push(pair<long long, pair<long long, long long>>(
              t, make_pair(CONST - (h[u] - height[u]), u)));
          vis[u] = 1;
        }
        break;
      }
      vis[u] = vis[0] = 1;
    }
    if (ok == 0) pq.pop();
  }
  cout << result;
}
