Cosmo is playing a little known recent entry in the Legend of Zelda series, "Skyward Wind Mask of Twilight Time". In this game the player is the young adventurer Link and has to finish all n objectives. Some objectives have to be finished before others. Every objective i (i=2,3,…,n) has one prerequisite Pi, and Pi has to be finished before i. Objective 1 has no prerequisite. The prerequisite relation has no cycles.
The game also hides cheats. There is one cheat for each objective i (i=2,3,…,n), and it lets Cosmo finish i before its prerequisite Pi. The order still cannot be broken completely. If the cheat for objective i is used, i no longer has to come after Pi, but it still has to come after PPi, the prerequisite of its prerequisite. If Pi=1, objective 1 has no prerequisite, so i can be finished at any point.
Cheats used too close to each other make the game behave unpredictably. If Cosmo uses the cheat for objective i, he cannot use the cheat for Pi, and he cannot use the cheat for any objective whose prerequisite is i. Two objectives that the prerequisite relation links directly can never both be cheated. Two objectives that share the same prerequisite can both be cheated.
Cosmo wants to finish the game using at most k cheats. Count the orders in which he can finish all n objectives under these rules. An order is counted once even when several different sets of cheats produce it. The answer can be very large, so print it modulo 109+7.
The input holds several test cases. Each test case begins with a line holding two integers n and k (1≤n≤200, 0≤k<n). n is the number of objectives and k is the largest number of cheats Cosmo is willing to use. The next line holds n−1 space separated integers (1≤p≤n), the prerequisites of objectives 2,3,…,n in that order. Objective 1 is skipped because it has no prerequisite. When n=1 this line is empty. The input ends with a line holding two zeros.
For each test case print one line with the number of orders in which Cosmo can finish all n objectives using at most k cheats, modulo 109+7. Print no spaces and no blank lines between the answers.
In the first example n=5 and the prerequisites are P2=1, P3=1, P4=5, P5=1. There are 12 orders that use no cheat, 12 that use the cheat for objective 4, 8 that use the cheat for objective 5, 3 that use the cheat for objective 2, and 3 that use the cheat for objective 3. The sum is 38.