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 long long MaxN = 1e5 + 50;
template <class t>
inline void read(t &s) {
  s = 0;
  register long long f = 1;
  register char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) s = (s << 3) + (s << 1) + (c ^ 48), c = getchar();
  s *= f;
  return;
}
template <class t, class... A>
inline void read(t &x, A &...a) {
  read(x);
  read(a...);
}
template <class t>
inline void write(t x) {
  if (x < 0) putchar('-'), x = -x;
  long long buf[21], top = 0;
  while (x) buf[++top] = x % 10, x /= 10;
  if (!top) buf[++top] = 0;
  while (top) putchar(buf[top--] ^ '0');
  return;
}
inline void setIn(std::string s) {
  freopen(s.c_str(), "r", stdin);
  return;
}
inline void setOut(std::string s) {
  freopen(s.c_str(), "w", stdout);
  return;
}
inline void setIO(std::string s = "") {
  setIn(s + ".in");
  setOut(s + ".out");
  return;
}
template <class t>
inline bool ckmin(t &x, t y) {
  if (x > y) {
    x = y;
    return 1;
  }
  return 0;
}
template <class t>
inline bool ckmax(t &x, t y) {
  if (x < y) {
    x = y;
    return 1;
  }
  return 0;
}
inline long long lowbit(long long x) { return x & (-x); }
std::vector<long long> E[MaxN];
long long f[MaxN], g[MaxN], up[MaxN][21], dep[MaxN], s[MaxN][21], to[MaxN],
    a[MaxN], n, L, S;
inline void dfs(long long u, long long fa) {
  up[u][0] = fa, dep[u] = dep[fa] + 1;
  for (auto v : E[u])
    if (v != fa) s[v][0] = a[u], dfs(v, u);
}
inline void dfs2(long long u, long long fa) {
  f[u] = -1;
  for (auto v : E[u])
    if (v != fa) dfs2(v, u), ckmax(f[u], f[v] - 1), g[u] += g[v];
  if (!~f[u]) f[u] = to[u], ++g[u];
}
signed main(void) {
  read(n, L, S);
  if (!L) return std::puts("-1"), 0;
  for (long long i = 1; i <= n; ++i) {
    read(a[i]);
    if (a[i] > S) return std::puts("-1"), 0;
  }
  register long long v;
  for (long long i = 2; i <= n; ++i)
    read(v), E[i].push_back(v), E[v].push_back(i);
  dfs(1, 0);
  for (long long k = 1; k < 21; ++k)
    for (long long i = 1; i <= n; ++i)
      up[i][k] = up[up[i][k - 1]][k - 1],
      s[i][k] = s[i][k - 1] + s[up[i][k - 1]][k - 1];
  for (long long i = 1; i <= n; ++i) {
    register long long pos = i, nl = 0, ns = a[i];
    for (long long k = 20; ~k; --k)
      if (up[pos][k] && nl + (1 << k) < L && ns + s[pos][k] <= S)
        nl += (1 << k), ns += s[pos][k], pos = up[pos][k];
    to[i] = nl;
  }
  dfs2(1, 0);
  write(g[1]), std::puts("");
  return 0;
}
