|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||4||3||2||100.000%|
All politicians of an unknown, completely invented and totally unrealistic country are spending their time accusing each other on national television instead of doing their jobs. It all started one Sunday afternoon when politician number 1 was a guest in the first episode of a (now very popular) talk show. During the show, he accused the politician number 2 for the poor state of the country. Naturally, in the second episode of the show the guest was politician number 2. The talk show host told his guest that politician number 1 accused him and politician number 2 then blamed some other politician. The newly blamed politician was the guest in the next show where the host told him that. . .
Even today, after almost 20 years, a new politician is a guest in each episode of the show where he is being told by whom he was accused for the poor state in the country. That politician then blames another politician and the vicious cycle continues. To make things more interesting, we have exclusively found out that each politician has a fixed strategy on how to behave during the show. More precisely, each politician knows who to blame based on the person who blamed him in previous show. We will provide you with this information and hope you will be able to write a program that calculates what politician will be the guest of the K-th show.
The first line contains integers N (2 ≤ N ≤ 500) and K (1 ≤ K ≤ 1018) from the task description.
The i-th of the next N lines contains N integers where j-th integer tells us who will be blamed by the i-th politician if he was blamed by politician number j in the last show.
You can assume that no politician will ever blame himself. Therefore, none of the numbers in i-th line of matrix will be equal to i. Similarly, note that the i-th number in the i-th matrix row will always be equal to 0 and can be disregarded.
In a single line you should output the number of a politician that will be the guest of the K-th episode of the talk show.
2 4 0 2 1 0
3 7 0 3 2 3 0 3 2 1 0
4 7 0 4 3 2 4 0 4 1 2 1 0 1 3 2 3 0