#include<bits/stdc++.h>
using namespace std;

const int N = 1e5 + 9;

int n, k, p, d[N], c, f[N];
vector<int>V[N];

void Dfs (int x) {
	d[x] = 1;
	for (auto v : V[x]) {
		Dfs(v);
		if (d[v] >= d[x]) d[x] = d[v] + 1;
	}
	if (f[x] > 1 && d[x] >= k)
	d[x] = 0, ++c;
}

int main () {
	scanf("%d%d%d", &n, &k, &p); f[1] = 1;
	for (int i = 2; i <= n; ++i) {
		scanf("%d", &f[i]);
		V[f[i]].emplace_back(i);
	}
	Dfs(1);
	if (p != 1) ++c;
	printf("%d\n", c);
	return 0;
}