{"raw_statement":[{"iden":"problem statement","content":"$N$ players with **ID numbers** $1, 2, \\ldots, N$ are playing a card game.  \nEach player plays one card.\nEach card has two parameters: **color** and **rank**, both of which are represented by positive integers.  \nFor $i = 1, 2, \\ldots, N$, the card played by player $i$ has a color $C_i$ and a rank $R_i$. All of $R_1, R_2, \\ldots, R_N$ are different.\nAmong the $N$ players, one **winner** is decided as follows.\n\n*   If one or more cards with the color $T$ are played, the player who has played the card with the greatest rank among those cards is the winner.\n*   If no card with the color $T$ is played, the player who has played the card with the greatest rank among the cards with the color of the card played by player $1$ is the winner. (Note that player $1$ may win.)\n\nPrint the ID number of the winner."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq T \\leq 10^9$\n*   $1 \\leq C_i \\leq 10^9$\n*   $1 \\leq R_i \\leq 10^9$\n*   $i \\neq j \\implies R_i \\neq R_j$\n*   All values in the input are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $T$\n$C_1$ $C_2$ $\\ldots$ $C_N$\n$R_1$ $R_2$ $\\ldots$ $R_N$"},{"iden":"sample input 1","content":"4 2\n1 2 1 2\n6 3 4 5"},{"iden":"sample output 1","content":"4\n\nCards with the color $2$ are played. Thus, the winner is player $4$, who has played the card with the greatest rank, $5$, among those cards."},{"iden":"sample input 2","content":"4 2\n1 3 1 4\n6 3 4 5"},{"iden":"sample output 2","content":"1\n\nNo card with the color $2$ is played. Thus, the winner is player $1$, who has played the card with the greatest rank, $6$, among the cards with the color of the card played by player $1$ (color $1$)."},{"iden":"sample input 3","content":"2 1000000000\n1000000000 1\n1 1000000000"},{"iden":"sample output 3","content":"1"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}