#include <bits/stdc++.h>
using namespace std;
long long s[200009], val[200009];
vector<int> son[200009];
int par[200009][20], lvl[200009];
long long remainingL[200009], remainingS[200009];
long long acum[200009][20];
long long S, L;
int ans = 0;
void dfs(int u) {
  for (int i = 0; i < int(son[u].size()); i++) {
    int v = son[u][i];
    dfs(v);
  }
  ans++;
  remainingS[u] = S - val[u];
  remainingL[u] = L - 1;
  int bestSon = -1, maxUp = -1;
  for (int i = 0; i < int(son[u].size()); i++) {
    int v = son[u][i];
    if (remainingS[v] < val[u]) continue;
    if (remainingL[v] == 0) continue;
    int k = v;
    long long sum = remainingS[v];
    for (int j = 20 - 1; j >= 0; j--) {
      if (acum[k][j] <= sum) {
        sum -= acum[k][j];
        k = par[k][j];
      }
    }
    int goUp = min(remainingL[v], 1LL * lvl[v] - lvl[k]);
    if (goUp > maxUp) {
      maxUp = goUp;
      bestSon = v;
    }
  }
  if (bestSon != -1) {
    ans--;
    remainingL[u] = remainingL[bestSon] - 1;
    remainingS[u] = remainingS[bestSon] - val[u];
  }
}
int main() {
  int n;
  scanf("%d %lld %lld", &n, &L, &S);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &val[i]);
    if (val[i] > S) {
      printf("-1\n");
      return 0;
    }
  }
  par[0][0] = 0;
  lvl[0] = 0;
  for (int i = 1; i <= n - 1; i++) {
    scanf("%d", &par[i][0]);
    par[i][0]--;
    acum[i][0] = val[par[i][0]];
    son[par[i][0]].push_back(i);
    lvl[i] = lvl[par[i][0]] + 1;
  }
  for (int j = 1; j < 20; j++) {
    for (int i = 0; i < n; i++) {
      par[i][j] = par[par[i][j - 1]][j - 1];
      acum[i][j] = acum[par[i][j - 1]][j - 1] + acum[i][j - 1];
    }
  }
  dfs(0);
  printf("%d\n", ans);
}
