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;
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class L, class R>
ostream& operator<<(ostream& os, map<L, R> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.F << ":" << m.S << ")";
  return os << "}";
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 1e5 + 100;
const int LN = 20;
vector<int> G[N];
long long n, l, s;
long long A[N];
long long dp[LN][N];
long long par[LN][N];
long long deg[N];
pair<long long, long long> choice[N];
long long best[N];
long long ans[N];
void dfs(int s, int p) {
  dp[0][s] = A[s];
  par[0][s] = p;
  for (auto it : G[s]) {
    if (it == p) continue;
    dfs(it, s);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(25);
  cin >> n >> l >> s;
  bool pos = true;
  for (int i = 1; i <= n; ++i) {
    cin >> A[i];
    if (A[i] > s) {
      pos = false;
    }
  }
  if (!pos) {
    cout << -1 << "\n";
    return 0;
  }
  int u, v;
  for (int i = 0; i < n - 1; ++i) {
    cin >> u;
    G[u].push_back(i + 2);
    ++deg[u];
  }
  dfs(1, 1);
  for (int k = 1; k < LN; ++k) {
    for (int i = 1; i <= n; ++i) {
      dp[k][i] = dp[k - 1][i] + dp[k - 1][par[k - 1][i]];
      par[k][i] = par[k - 1][par[k - 1][i]];
    }
  }
  queue<long long> Q;
  for (int i = 1; i <= n; ++i) {
    if (deg[i] == 0) {
      Q.push(i);
      ans[i] = 1;
      choice[i] = make_pair(l, s);
    }
  }
  while (Q.size() > 0) {
    auto it = Q.front();
    Q.pop();
    pair<long long, long long> curr = choice[it];
    if (curr.first == 0 || curr.second < A[it]) {
      ++ans[it];
      curr = make_pair(l, s);
    }
    if (it == 1) break;
    long long dis = 0;
    long long sm = 0;
    long long tmp = it;
    for (int i = LN - 1; i >= 0; --i) {
      if (dis + (1ll << i) <= curr.first && dp[i][tmp] + sm <= curr.second) {
        dis += (1ll << i);
        sm += dp[i][tmp];
        tmp = par[i][tmp];
      }
    }
    if (best[par[0][it]] < dis) {
      best[par[0][it]] = dis;
      choice[par[0][it]] = make_pair(curr.first - 1, curr.second - A[it]);
    }
    --deg[par[0][it]];
    ans[par[0][it]] += ans[it];
    if (deg[par[0][it]] == 0) {
      Q.push(par[0][it]);
    }
  }
  assert(Q.size() == 0);
  cout << ans[1] << "\n";
  return 0;
}
