{"raw_statement":[{"iden":"problem statement","content":"Takahashi has $N$ friends. They have nicknames: Friend $1$, Friend $2$, $\\ldots$, Friend $N$.\nOne day, Takahashi accidentally let one of his friends, Friend $X$, learn his shameful secret.  \nFor each $i = 1, 2, \\ldots, N$, when Friend $i$ learns the secret, he/she will share it with Friend $A_i$, if Friend $A_i$ has not already learned it.\nHow many of Takahashi's friends will learn the secret in the end?"},{"iden":"constraints","content":"*   $2 \\leq N \\leq 10^5$\n*   $1 \\leq X \\leq N$\n*   $1 \\leq A_i \\leq N$\n*   $A_i \\neq i$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $X$\n$A_1$ $A_2$ $\\cdots$ $A_N$"},{"iden":"sample input 1","content":"4 2\n3 1 1 2"},{"iden":"sample output 1","content":"3\n\nTakahashi's secret will be learned by Friend $1$, Friend $2$, and Friend $3$, as follows.\n\n*   One day, Takahashi let Friend $2$ learn the secret.\n*   Friend $2$ shares it with Friend $1$.\n*   Friend $1$ shares it with Friend $3$.\n\nIn the end, three of his friends learn the secret, so we print $3$."},{"iden":"sample input 2","content":"20 12\n7 11 10 1 7 20 14 2 17 3 2 5 19 20 8 14 18 2 10 10"},{"iden":"sample output 2","content":"7"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}