Cheats

No attempts yetTime limit10sMemory limit256 MB

Problem

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 nn objectives. Some objectives have to be finished before others. Every objective ii (i=2,3,,ni = 2, 3, \dots, n) has one prerequisite PiP_i, and PiP_i has to be finished before ii. Objective 1 has no prerequisite. The prerequisite relation has no cycles.

The game also hides cheats. There is one cheat for each objective ii (i=2,3,,ni = 2, 3, \dots, n), and it lets Cosmo finish ii before its prerequisite PiP_i. The order still cannot be broken completely. If the cheat for objective ii is used, ii no longer has to come after PiP_i, but it still has to come after PPiP_{P_i}, the prerequisite of its prerequisite. If Pi=1P_i = 1, objective 1 has no prerequisite, so ii 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 ii, he cannot use the cheat for PiP_i, and he cannot use the cheat for any objective whose prerequisite is ii. 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 kk cheats. Count the orders in which he can finish all nn 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+710^9+7.

Input

The input holds several test cases. Each test case begins with a line holding two integers nn and kk (1n2001 \le n \le 200, 0k<n0 \le k < n). nn is the number of objectives and kk is the largest number of cheats Cosmo is willing to use. The next line holds n1n-1 space separated integers (1pn1 \le p \le n), the prerequisites of objectives 2,3,,n2, 3, \dots, n in that order. Objective 1 is skipped because it has no prerequisite. When n=1n = 1 this line is empty. The input ends with a line holding two zeros.

Output

For each test case print one line with the number of orders in which Cosmo can finish all nn objectives using at most kk cheats, modulo 109+710^9+7. Print no spaces and no blank lines between the answers.

Note

In the first example n=5n = 5 and the prerequisites are P2=1P_2 = 1, P3=1P_3 = 1, P4=5P_4 = 5, P5=1P_5 = 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.