#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int lg = 20;
const long long inf = 1e18;
int n, L;
long long S;
long long t[4 * maxn];
long long t_add[4 * maxn];
int cid = 0;
int w[maxn];
vector<int> down[maxn];
long long sum[maxn];
int up[maxn];
int p[maxn][lg];
long long dp[maxn];
int id[maxn], rb[maxn];
long long dp_sum[maxn];
vector<int> rm[maxn];
inline long long get_sum(int v) { return v == -1 ? 0 : sum[v]; }
void preprocess(int v, int pr = -1) {
  sum[v] = get_sum(pr) + w[v];
  p[v][0] = pr;
  up[v] = v;
  id[v] = rb[v] = cid++;
  for (int i = 1; i < lg; i++)
    p[v][i] = p[v][i - 1] == -1 ? -1 : p[p[v][i - 1]][i - 1];
  int dist = L - 1;
  for (int i = lg - 1; i >= 0; i--) {
    if (p[up[v]][i] == -1 || (1 << i) > dist) continue;
    if (get_sum(v) - get_sum(p[up[v]][i]) + w[p[up[v]][i]] <= S) {
      dist -= 1 << i;
      up[v] = p[up[v]][i];
    }
  }
  rm[up[v]].push_back(v);
  for (int u : down[v]) {
    preprocess(u, v);
    rb[v] = max(rb[v], rb[u]);
  }
}
inline void push(int v) {
  t[2 * v] += t_add[v];
  t[2 * v + 1] += t_add[v];
  t_add[2 * v] += t_add[v];
  t_add[2 * v + 1] += t_add[v];
  t_add[v] = 0;
}
void build_tree(int v, int l, int r) {
  t[v] = inf;
  if (l == r) return;
  int mid = (l + r) / 2;
  build_tree(2 * v, l, mid);
  build_tree(2 * v + 1, mid + 1, r);
}
long long get_tree(int v, int l, int r, int ul, int ur) {
  if (ul > ur) return inf;
  if (l == ul && r == ur) return t[v];
  push(v);
  int mid = (l + r) / 2;
  return min(get_tree(2 * v, l, mid, ul, min(ur, mid)),
             get_tree(2 * v + 1, mid + 1, r, max(ul, mid + 1), ur));
}
void set_tree(int v, int l, int r, int pos, long long val) {
  if (l == r) {
    t[v] = val;
    return;
  }
  push(v);
  int mid = (l + r) / 2;
  if (pos <= mid)
    set_tree(2 * v, l, mid, pos, val);
  else
    set_tree(2 * v + 1, mid + 1, r, pos, val);
  t[v] = min(t[2 * v], t[2 * v + 1]);
}
void add_tree(int v, int l, int r, int ul, int ur, long long val) {
  if (ul > ur) return;
  if (l == ul && r == ur) {
    t[v] += val;
    t_add[v] += val;
    return;
  }
  push(v);
  int mid = (l + r) / 2;
  add_tree(2 * v, l, mid, ul, min(ur, mid), val);
  add_tree(2 * v + 1, mid + 1, r, max(ul, mid + 1), ur, val);
  t[v] = min(t[2 * v], t[2 * v + 1]);
}
inline void upd(int v) { dp[v] = 1 + get_tree(1, 0, n - 1, id[v], rb[v]); }
inline void add(int v) {
  set_tree(1, 0, n - 1, id[v], 0);
  add_tree(1, 0, n - 1, id[v], rb[v], dp_sum[v] - dp[v]);
}
inline void remove(int v) { set_tree(1, 0, n - 1, id[v], inf); }
void solve(int v) {
  for (int u : down[v]) {
    solve(u);
    dp_sum[v] += dp[u];
  }
  add(v);
  dp[v] = maxn;
  upd(v);
  add_tree(1, 0, n - 1, id[v], rb[v], -dp[v]);
  for (int u : rm[v]) remove(u);
}
int main() {
  scanf("%d%d%lld", &n, &L, &S);
  for (int i = 0; i < n; i++) {
    scanf("%d", &w[i]);
    if (w[i] > S) {
      printf("-1");
      return 0;
    }
  }
  for (int i = 1; i < n; i++) {
    int j;
    scanf("%d", &j);
    down[--j].push_back(i);
  }
  preprocess(0);
  build_tree(1, 0, n - 1);
  solve(0);
  printf("%lld", dp[0]);
}
