#include <bits/stdc++.h>
using namespace std;
int n, L;
long long S;
const int N = 1e5 + 10;
vector<int> G[N];
long long w[N];
int d[N], ud[N];
long long sum[N];
void Maxi(int &a, int b) {
  if (b > a) a = b;
}
void dfs(int v = 1, int depth = 1) {
  d[v] = depth;
  sum[depth] = sum[depth - 1] + w[v];
  ud[v] = lower_bound(sum, sum + depth, sum[depth] - S) - sum + 1;
  Maxi(ud[v], depth - L + 1);
  for (auto u : G[v]) {
    dfs(u, depth + 1);
  }
}
int ans = 0;
void Mini(int &a, int b) {
  if (b < a) a = b;
}
int solve(int v = 1) {
  int up = d[v] + 1;
  for (auto u : G[v]) {
    Mini(up, solve(u));
  }
  if (up <= d[v]) return up;
  ans++;
  return ud[v];
}
int main() {
  scanf("%d%d%lld", &n, &L, &S);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", w + i);
    if (w[i] > S) {
      return puts("-1"), 0;
    }
  }
  for (int i = 2; i <= n; i++) {
    int p;
    scanf("%d", &p);
    G[p].push_back(i);
  }
  dfs();
  solve();
  printf("%d\n", ans);
}
