text: Having stood for about three hours in the queue, the Smart Beaver realized that many beavers had not seen who was supposed to stand in the queue before them and there was a huge mess.He came up to each beaver in the ECG room queue and asked who should be in front of him in the queue.If the beaver did not know his correct position in the queue, then it might be his turn to go get an ECG, or maybe he should wait for a long, long time...As you've guessed, the Smart Beaver was in a hurry home, so he gave you all the necessary information for you to help him to determine what his number in the queue can be.Input The first line contains two integers n (1 ≤ n ≤ 103) and x (1 ≤ x ≤ n) — the number of beavers that stand in the queue and the Smart Beaver's number, correspondingly.All willing to get to the doctor are numbered from 1 to n.The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ n) — the number of the beaver followed by the i-th beaver.If ai = 0, then the i-th beaver doesn't know who is should be in front of him.It is guaranteed that values ai are correct.That is there is no cycles in the dependencies.And any beaver is followed by at most one beaver in the queue.The input limits for scoring 30 points are (subproblem B1): * It is guaranteed that the number of zero elements ai doesn't exceed 20.The input limits for scoring 100 points are (subproblems B1+B2): * The number of zero elements ai is arbitrary.Output Print all possible positions of the Smart Beaver in the line in the increasing order.Examples Input 6 1 2 0 4 0 6 0 Output 2 4 6 Input 6 2 2 3 0 5 6 0 Output 2 5 Input 4 1 0 0 0 0 Output 1 2 3 4 Input 6 2 0 0 1 0 4 5 Output 1 3 4 6 Note <image> Picture for the fourth test.# Solution #include <bits/stdc++.