#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, l, fa[N][20], f[N], h[N], lim, bin[20];
long long s, g[N], val[N][20];
vector<int> to[N];
void dfs(int u) {
  for (int i = 1; i <= lim; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  for (int i = 1; i <= lim; i++)
    val[u][i] = val[u][i - 1] + val[fa[u][i - 1]][i - 1];
  for (auto v : to[u]) dfs(v);
}
void dfs2(int u) {
  int maxn = 0, maxid = -1;
  for (auto v : to[u]) {
    dfs2(v);
    f[u] += f[v];
    int x = u, cl = h[v];
    long long cs = g[v];
    for (int i = lim; i >= 0; i--)
      if (fa[x][i] && cl + bin[i] <= l && cs + val[x][i] <= s)
        cl += bin[i], cs += val[x][i], x = fa[x][i];
    if (cl + 1 <= l && cs + val[x][0] <= s) cl++, cs += val[x][0];
    if (cl - h[v] > maxn) maxn = cl - h[v], maxid = v;
  }
  if (maxid != -1)
    h[u] = h[maxid] + 1, g[u] = g[maxid] + val[u][0];
  else
    h[u] = 1, g[u] = val[u][0], ++f[u];
}
int main() {
  scanf("%d%d%lld", &n, &l, &s);
  lim = log(n) / log(2);
  bin[0] = 1;
  for (int i = 1; i <= lim; i++) bin[i] = (bin[i - 1] << 1);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &val[i][0]);
    if (1ll * val[i][0] > s) return printf("-1\n"), 0;
  }
  for (int i = 2; i <= n; i++)
    scanf("%d", &fa[i][0]), to[fa[i][0]].push_back(i);
  dfs(1);
  dfs2(1);
  printf("%d\n", f[1]);
  return 0;
}
