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 safe places in the city. Equipped with plenty of medicines, masks, alcohol, and respirators, Guseyn plans to set up caches at these 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 , there is a one-way safe path to the -th safe place ( < ), 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.
The first line contains two integers and – the number of safe places and the number of caches Guseyn wants to set up (1 \le k \le n \le 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 originates from the p_i-th safe place (1 \le p_i < i).
Output a single integer – the maximum number of safe places from which it is possible to reach a cache with optimal cache placement.
Example 1
Example 2
Example 3