#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, P;
long long S;
int W[maxn], fa[maxn];
int is_leaf[maxn], vis[maxn];
void dfs(int x) {
  if (!is_leaf[x]) return;
  is_leaf[fa[x]] = false;
  dfs(fa[x]);
}
int main() {
  scanf("%d%d%lld", &n, &P, &S);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &W[i]);
    if (W[i] > S) {
      printf("-1\n");
      return 0;
    }
  }
  fa[1] = 0;
  for (int i = 2; i <= n; i++) scanf("%d", &fa[i]);
  for (int i = 1; i <= n; i++) is_leaf[i] = 1;
  int ans = 0;
  for (int i = n; i >= 1; i--) {
    if (!vis[i]) {
      int tmp = i;
      int tmp_P = P;
      long long tmp_S = S;
      ans++;
      while (tmp && tmp_P > 0 && tmp_S >= W[tmp]) {
        vis[tmp] = 1;
        tmp_P--;
        tmp_S -= W[tmp];
        tmp = fa[tmp];
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
