#include <bits/stdc++.h>
using namespace std;
int par[20][100005], n, L, sol;
vector<int> ms[100005];
long long ss[20][100005], w[100005], S;
const long long inf = 2e18;
int dfs(int x) {
  int ret = 0;
  for (vector<int>::iterator i = ms[x].begin(); i != ms[x].end(); ++i) {
    int o = *i;
    int t = dfs(o);
    ret = max(ret, t - 1);
  }
  if (!ret) {
    sol++;
    int br = 0, sad = x;
    long long sum = 0;
    for (int i = 18; i >= 0; --i) {
      if (br + (1 << i) <= L && sum + ss[i][sad] <= S) {
        sum += ss[i][sad];
        br += (1 << i);
        sad = par[i][sad];
      }
    }
    ret = br;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> L >> S;
  bool p = 1;
  for (int i = 1; i <= n; ++i) {
    cin >> w[i];
    if (w[i] > S) {
      p = 0;
    }
    ss[0][i] = w[i];
  }
  for (int i = 2; i <= n; ++i) {
    cin >> par[0][i];
    ms[par[0][i]].push_back(i);
  }
  if (!p) {
    cout << -1 << endl;
    return 0;
  }
  ss[0][0] = inf;
  for (int i = 1; i <= 18; ++i) {
    for (int j = 1; j <= n; ++j) {
      par[i][j] = par[i - 1][par[i - 1][j]];
      ss[i][j] = min(ss[i - 1][j] + ss[i - 1][par[i - 1][j]], inf);
    }
  }
  dfs(1);
  cout << sol << endl;
  return 0;
}
