God saves the man who saves himself!
Guseyn is taking quarantine and safety measures very seriously. Feeling bored at home alone, he wants to go for a walk, but it's risky! He knows that there are n safe places in the city. Equipped with plenty of medicines, masks, alcohol, and respirators, Guseyn plans to set up k caches at these n safe places. His goal is to maximize the number of safe places from which he can reach any of these caches. Guseyn starts at the first safe place and has information about safe paths connecting these places. From each safe place numbered i, there is a one-way safe path to the j-th safe place (i < j), and you cannot return. Guseyn wants to know the maximum number of safe places from which a cache can be reached if the caches are placed optimally.
Input
The first line contains two integers n and k – the number of safe places and the number of caches Guseyn wants to set up( 1 <= k <= n <= 300000). The second line contains n-1 integers p[2]
, p[3]
, ..., p[n]
. Each p[i]
indicates that the safe path to the safe place i originates from the p[i]
-th safe place ( 1 <= p[i]
< i ).
Output
Output a single integer – the maximum number of safe places from which it is possible to reach a cache with optimal cache placement.