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;
using ii = pair<int, int>;
using ll = long long;
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << "[ ";
  for (auto e : v) os << e << " ";
  return os << "]";
}
template <typename T, typename V>
ostream& operator<<(ostream& os, set<T, V> v) {
  os << "{ ";
  for (auto e : v) os << e << " ";
  return os << "}";
}
template <typename T, typename V, typename S>
ostream& operator<<(ostream& os, map<T, V, S> v) {
  os << "{ ";
  for (auto e : v) os << e << " ";
  return os << "}";
}
template <typename T, typename V>
ostream& operator<<(ostream& os, pair<T, V> x) {
  return os << "( " << x.first << ", " << x.second << " )";
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& e : v) is >> e;
  return is;
}
template <typename T, typename V>
istream& operator>>(istream& is, pair<T, V>& x) {
  return is >> x.first >> x.second;
}
template <typename T>
T divfloor(T a, T b) {
  assert(b != 0);
  if (a >= 0 && b > 0 || a <= 0 && b < 0) return a / b;
  return (a % b == 0) ? a / b : a / b - 1;
}
template <typename T>
T divceil(T a, T b) {
  assert(b != 0);
  if (a >= 0 && b > 0 || a <= 0 && b < 0)
    return (a % b == 0) ? a / b : a / b + 1;
  return a / b;
}
void solve();
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
void solve() {
  int n, L;
  ll S;
  cin >> n >> L >> S;
  vector<vector<ll>> w(18, vector<ll>(n, 0));
  vector<vector<int>> p(18, vector<int>(n, -1));
  cin >> w[0];
  for (auto weight : w[0]) {
    if (weight > S) {
      cout << "-1\n";
      return;
    }
  }
  vector<vector<int>> c(n);
  for (int i = 1; i < n; ++i) {
    cin >> p[0][i];
    --p[0][i];
    c[p[0][i]].push_back(i);
  }
  for (int k = 1; k < 18; ++k) {
    for (int i = 0; i < n; ++i) {
      if (p[k - 1][i] != -1) p[k][i] = p[k - 1][p[k - 1][i]];
    }
  }
  for (int k = 1; k < 18; ++k) {
    for (int i = 0; i < n; ++i) {
      if (p[k - 1][i] != -1) {
        w[k][i] = w[k - 1][i] + w[k - 1][p[k - 1][i]];
      } else {
        w[k][i] = w[k - 1][i];
      }
    }
  }
  vector<int> up(n, L);
  for (int i = 0; i < n; ++i) {
    ll s = 0;
    int u = i, d = 0;
    for (int k = 17; k >= 0 && u != -1; --k) {
      if (s + w[k][u] <= S) {
        s += w[k][u];
        u = p[k][u];
        d |= 1 << k;
      }
    }
    up[i] = min(d, up[i]);
  }
  function<pair<ll, int>(int)> f = [&](int u) {
    ll sum = 0;
    int bound = 0;
    for (auto v : c[u]) {
      auto x = f(v);
      sum += x.first;
      bound = max(bound, x.second - 1);
    }
    if (bound == 0) return make_pair(sum + 1LL, up[u]);
    return make_pair(sum, bound);
  };
  cout << f(0).first << "\n";
}
