Family Tree

Time limit2sMemory limit64 MB

Problem

The alien Peter wants to organize his family tree. After weeks of hard work he finished a draft (beta version) of it.

Looking the draft over, he noticed that some ancestors had far too many parents. (An alien may have at most d parents.) Peter therefore suspected that some parent-child links are really more distant ancestor-descendant relationships.

Write a program that computes the minimum number of ancestors Peter must insert to turn the family tree into a satisfactory form.

A family tree is in satisfactory form when every alien has at most d parents and each alien appears in the tree exactly once.

For example, if d = 2 and Peter's draft looks like this,

then adding the two ancestors shown below makes it satisfactory.

Input

The first line contains two integers n and d (2 ≤ n ≤ 100,000, 2 ≤ d ≤ n).

The second line contains n integers separated by spaces. The i-th integer is the number of the alien that alien i designates as its child; that is, alien i is a parent of that alien.

The ancestors appearing in Peter's family tree are numbered from 1 to n, and Peter himself is numbered 0.

Output

Print the minimum number of ancestors that must be added to make the family tree satisfactory.