P21422 [HackerEarth] You are given a tree consising of N vertices. What is the minimum number of vertices that should be removed that all the remaining parts of the initial tree will contain less than K vert
提高-
题目描述

You are given a tree consising of N vertices. What is the minimum number of vertices that should be removed that all the remaining parts of the initial tree will contain less than K vertices?

Input
The first line contains one integer K.
The second line contains one integer N.
The third line contains N-1 space-separated intgers ai for 2 ≤ i ≤ N which means that vertices i and ai are connected by an edge.

Output
Output one number - answer for the question.

Constraints
1 ≤ K, N ≤ 10 000
ai < i

SAMPLE INPUT
3
12
1 1 2 2 3 2 3 6 6 6 7

SAMPLE OUTPUT
3

Explanation

We can remove vertices 2, 3, 6.

输入格式

见题面

输出格式

见题面

样例输入
1000 45 1 2 3 4 4 2 1 4 9 10 11 12 10 10 15 15 10 9 9 1 2 3 4 4 2 1 12 9 10 11 12 10 10 15 15 10 9 9 20 22 20 22 20 1
样例输出
1