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 int MOD = 1e9 + 7;
const int INF = 2e9;
const long long LINF = 4e18;
const long long delta = 1634569;
const int N = 1e5 + 20;
const int LOG = 19;
vector<int> G[N];
long long n, L, S, w[N], up[N][LOG], par[N][LOG], h[N], f[N];
pair<int, int> dp[N];
long long getsum(int v, int k) {
  if (k == 0) return w[v];
  long long x = w[v];
  for (int i = LOG - 1; i >= 0; i--)
    if (k & (1 << i)) {
      x += up[v][i];
      v = par[v][i];
      if (v == 0) return LINF;
    }
  return x;
}
int getpar(int v, int k) {
  if (k == 0) return v;
  for (int i = LOG - 1; i >= 0; i--)
    if (k & (1 << i)) v = par[v][i];
  return (v ? v : -1);
}
void dfs0(int v, int p = -1) {
  if (p + 1) {
    h[v] = h[p] + 1;
    par[v][0] = p;
    up[v][0] = w[p];
  }
  for (int i = 1; i < LOG; i++) par[v][i] = par[par[v][i - 1]][i - 1];
  for (int i = 1; i < LOG; i++)
    up[v][i] = up[v][i - 1] + up[par[v][i - 1]][i - 1];
  int lf = 0, rg = L;
  while (rg - lf > 1) {
    int mid = (lf + rg) / 2;
    (getsum(v, mid) <= S ? lf : rg) = mid;
  }
  f[v] = h[getpar(v, lf)];
  for (int u : G[v]) dfs0(u, v);
}
void dfs1(int v) {
  if (G[v].size() == 0)
    dp[v] = make_pair(1, f[v]);
  else {
    int x = 0, y = INF;
    for (int u : G[v]) {
      dfs1(u);
      x += dp[u].first;
      y = min(y, dp[u].second);
    }
    if (y > h[v])
      dp[v] = make_pair(x + 1, f[v]);
    else
      dp[v] = make_pair(x, y);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> L >> S;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 2, v; i <= n; i++) {
    cin >> v;
    G[v].push_back(i);
  }
  for (int i = 1; i <= n; i++)
    if (w[i] > S) return cout << -1 << endl, 0;
  dfs0(1);
  dfs1(1);
  cout << dp[1].first << endl;
}
