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;
ifstream in;
ofstream out;
const long long kk = 1000;
const long long ml = kk * kk;
const long long mod = ml * kk + 7;
const long long inf = ml * ml * ml + 7;
const long long gs = 200 * kk;
long long n, m, i, j, ans, L, second;
vector<long> reb[gs + 10];
long long p[20][gs];
long long w[20][gs];
vector<long long> wp, up;
long long col[gs + 10];
long long tc[gs + 10];
bool viv = false;
void read() {
  cin >> n >> L >> second;
  m = n - 1;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    wp.push_back(a);
    if (wp.back() > second) {
      cout << -1;
      exit(0);
    }
  }
  for (long long i = 1; i < n; i++) {
    long long a;
    cin >> a;
    a--;
    reb[a].push_back(i);
    reb[i].push_back(a);
  }
}
void DFS(long v, long c) {
  col[v] = c;
  long l = reb[v].size();
  for (long i = 0; i < l; i++) {
    long s = reb[v][i];
    if (col[s] == -1) {
      DFS(s, c + 1);
    }
  }
}
vector<long long> sorted() {
  for (i = 0; i < n; i++) col[i] = -1;
  DFS(0, 0);
  vector<pair<long long, long long> > tos;
  for (long long i = 0; i < n; i++) tos.push_back({col[i], i});
  sort(tos.rbegin(), tos.rend());
  vector<long long> por;
  for (auto i : tos) por.push_back(i.second);
  return por;
}
void parents() {
  for (long long v = 0; v < n; v++)
    for (auto s : reb[v])
      if (col[s] < col[v]) p[0][v] = s, w[0][v] = wp[s];
  w[0][0] = inf;
  for (long long j = 1; j < 20; j++)
    for (long long v = 0; v < n; v++) {
      long long s = p[j - 1][v];
      p[j][v] = p[j - 1][s], w[j][v] = w[j - 1][v] + w[j - 1][s],
      w[j][v] = min(w[j][v], inf);
    }
  for (long long i = 0; i < n; i++) up.push_back(inf);
}
void build(long long v) {
  long long vost = L;
  vost--;
  long long wost = second;
  wost -= wp[v];
  long long add = 1LL << 19;
  long long cur = v;
  for (long long j = 19; j >= 0; j--) {
    if (add <= vost && w[j][cur] <= wost) {
      wost -= w[j][cur];
      vost -= add;
      cur = p[j][cur];
    }
    add >>= 1;
  }
  up[v] = cur;
}
void work(long long v) {
  vector<long long> kids;
  for (auto s : reb[v])
    if (col[s] > col[v]) kids.push_back(s);
  if (kids.size()) ans += kids.size() - 1;
  long long upto = inf;
  for (auto s : kids)
    if (up[s] <= v) upto = min(upto, up[s]);
  if (upto == inf) {
    if (kids.size()) ans++;
    build(v);
    return;
  }
  up[v] = upto;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  read();
  vector<long long> por = sorted();
  parents();
  for (auto i : por) work(i);
  ans++;
  cout << ans << endl;
  if (viv) {
    for (i = 0; i < n; i++)
      cout << '{' << p[0][i] << ' ' << w[0][i] << '}' << ' ';
    cout << endl;
    for (auto i : por) cout << i << ' ';
    cout << endl;
    for (auto i : up) cout << i << ' ';
    cout << endl;
    for (long long v = 0; v < n; v++) {
      cout << v << ": ";
      for (auto s : reb[v]) cout << s << ' ';
      cout << endl;
    }
    for (i = 0; i < n; i++) cout << col[i] << ' ';
    cout << endl;
  }
  return 0;
}
