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 long long MAXN = 1e5 + 5;
long long w[MAXN];
vector<long long> path[MAXN];
long long dp[MAXN], sdp[MAXN];
vector<long long> nd[MAXN];
long long n, l, s;
long long ver[MAXN], tin[MAXN], tout[MAXN];
pair<long long, long long> dfahdasfdashsdf[MAXN << 2];
long long fasjkfhdksjafhasdfadfs[MAXN << 2];
void push_weight(long long id, long long l, long long r) {
  dfahdasfdashsdf[id].first += fasjkfhdksjafhasdfadfs[id];
  if (l != r) {
    fasjkfhdksjafhasdfadfs[id << 1] += fasjkfhdksjafhasdfadfs[id];
    fasjkfhdksjafhasdfadfs[id << 1 | 1] += fasjkfhdksjafhasdfadfs[id];
  }
  fasjkfhdksjafhasdfadfs[id] = 0;
}
void build_weight(long long id = 1, long long l = 1, long long r = n) {
  if (l == r) {
    dfahdasfdashsdf[id].second = ver[l];
    return;
  }
  long long mid = l + r >> 1;
  build_weight(id << 1, l, mid);
  build_weight(id << 1 | 1, mid + 1, r);
  dfahdasfdashsdf[id] =
      max(dfahdasfdashsdf[id << 1], dfahdasfdashsdf[id << 1 | 1]);
}
void upd_weight(long long u, long long v, long long val, long long id = 1,
                long long l = 1, long long r = n) {
  push_weight(id, l, r);
  if (r < u || l > v) return;
  if (l >= u && r <= v) {
    fasjkfhdksjafhasdfadfs[id] = val;
    push_weight(id, l, r);
    return;
  }
  long long mid = l + r >> 1;
  upd_weight(u, v, val, id << 1, l, mid);
  upd_weight(u, v, val, id << 1 | 1, mid + 1, r);
  dfahdasfdashsdf[id] =
      max(dfahdasfdashsdf[id << 1], dfahdasfdashsdf[id << 1 | 1]);
}
pair<long long, long long> max_weight(long long u, long long v,
                                      long long id = 1, long long l = 1,
                                      long long r = n) {
  push_weight(id, l, r);
  if (r < u || l > v) return {0, 0};
  if (l >= u && r <= v) return dfahdasfdashsdf[id];
  long long mid = l + r >> 1;
  return max(max_weight(u, v, id << 1, l, mid),
             max_weight(u, v, id << 1 | 1, mid + 1, r));
}
long long st[MAXN << 2], lz[MAXN << 2];
void push(long long id, long long l, long long r) {
  st[id] += lz[id];
  if (st[id] > 1e18) st[id] = 1e18;
  if (l != r) {
    lz[id << 1] += lz[id];
    lz[id << 1 | 1] += lz[id];
    if (lz[id << 1] > 1e18) lz[id << 1] = 1e18;
    if (lz[id << 1 | 1] > 1e18) lz[id << 1 | 1] = 1e18;
  }
  lz[id] = 0;
}
void upd(long long u, long long v, long long val, long long id = 1,
         long long l = 1, long long r = n) {
  push(id, l, r);
  if (r < u || l > v) return;
  if (l >= u && r <= v) {
    lz[id] = val;
    push(id, l, r);
    return;
  }
  long long mid = l + r >> 1;
  upd(u, v, val, id << 1, l, mid);
  upd(u, v, val, id << 1 | 1, mid + 1, r);
  st[id] = min(st[id << 1], st[id << 1 | 1]);
}
long long gmin(long long u, long long v, long long id = 1, long long l = 1,
               long long r = n) {
  push(id, l, r);
  if (r < u || l > v) return 1e18;
  if (l >= u && r <= v) return st[id];
  long long mid = l + r >> 1;
  return min(gmin(u, v, id << 1, l, mid), gmin(u, v, id << 1 | 1, mid + 1, r));
}
long long mx_dep = 0;
void dfs(long long u, long long dep = 0) {
  static long long timer = 0;
  tin[u] = ++timer;
  ver[timer] = u;
  nd[dep].push_back(u);
  mx_dep = max(mx_dep, dep);
  for (long long v : path[u]) dfs(v, dep + 1);
  tout[u] = timer;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> l >> s;
  for (long long i = 1; i <= n; i++) {
    cin >> w[i];
    if (w[i] > s) return cout << -1, 0;
  }
  for (long long i = 2, p; i <= n; i++) cin >> p, path[p].push_back(i);
  dfs(1);
  build_weight();
  for (long long i = mx_dep; i >= 0; i--)
    for (long long u : nd[i]) {
      if (i + l <= n)
        for (long long v : nd[i + l]) upd(tin[v], tin[v], 1e18);
      upd_weight(tin[u], tout[u], w[u]);
      for (long long v : path[u]) sdp[u] += dp[v];
      while (true) {
        auto vv = max_weight(tin[u], tout[u]);
        if (vv.first <= s) break;
        upd(tin[vv.second], tin[vv.second], 1e18);
        upd_weight(tin[vv.second], tin[vv.second], -1e18);
      }
      dp[u] = min(sdp[u] + 1, sdp[u] + 1 + gmin(tin[u] + 1, tout[u]));
      upd(tin[u], tin[u], sdp[u] - dp[u]);
    }
  cout << dp[1] << '\n';
}
