#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int N = 1e5 + 10;
vector<ll> G[N];
vector<P> ord;
;
vector<P> f[N];
ll n, L, S;
ll w[N];
int cnt = 0;
void dfs(int cur) {
  for (auto u : G[cur]) dfs(u);
  ord.push_back({++cnt, cur});
}
int main() {
  cin >> n >> L >> S;
  for (ll i = 1; i <= n; i++) {
    cin >> w[i];
    if (w[i] > S) return puts("-1"), 0;
  }
  for (ll i = 2; i <= n; i++) {
    ll p;
    cin >> p;
    G[p].push_back(i);
  }
  dfs(1);
  sort(ord.begin(), ord.end());
  ll ans = 0;
  for (int i = 0; i < ord.size(); ++i) {
    auto tmp = ord[i];
    for (auto j : G[tmp.second]) {
      for (auto p : f[j])
        if (p.first + 1 <= L && p.second + w[tmp.second] <= S)
          f[tmp.second].push_back({p.first + 1, p.second + w[tmp.second]});
    }
    if (f[tmp.second].empty())
      f[tmp.second].push_back({1, w[tmp.second]}), ++ans;
  }
  cout << ans << endl;
  return 0;
}
