Sages
In the kingdom of Olympia, there are N wise men, each possessing perfect intellectual abilities. To foster creativity among the kingdom's intellectual elite, the king has established a unique tradition.
Every evening, M hats are painted in one of K different colors. Specifically, M_i hats are painted in the i-th color (i = 1..K). The wise men are informed of this distribution. While they sleep, each wise man is assigned a hat, and the remaining hats are hidden. Upon waking, they sit in a circle, allowing each to see the hats of all others, and begin deducing the color of their own hat. The process unfolds as follows: each wise man writes on a piece of paper whether he knows the color of his hat. They then reveal their papers simultaneously. If anyone has determined their hat's color, the process ends, and they proceed to breakfast. If no one can ascertain their hat's color, they think again, and the paper-revealing process repeats.
Your task is to write a program that, given the color information of all hats and their distribution among the wise men, determines which wise men will first deduce the color of their hats and how many rounds of paper-revealing are needed, or establishes that it is impossible for anyone to do so.
Input
The first line contains three integers: N (1 ≤ N ≤ 10^6) - the number of wise men, M (N ≤ M ≤ 10^6) - the total number of hats, and K (1 ≤ K ≤ 10^6) - the number of different colors. The second line contains K integers, each representing the number of hats of a specific color. The third line consists of N integers, indicating the colors of the hats worn by each wise man. The colors are numbered from 1 to K.
Output
The first line should list the numbers of the wise men, in ascending order, who will first deduce the color of their hats. The second line should contain a single integer, representing the number of rounds of paper-revealing required. If it is impossible for any wise man to determine their hat's color, the output should be a single line containing the digit 0 (zero).
Explanation: Consider a scenario with three wise men, where two wear white hats (color 1) and one wears a black hat (color 2). Additionally, one more white and one more black hat are hidden. In the first round, no one can determine their hat's color. In the second round, each wise man with a white hat reasons: "If I had a black hat, then the colleague with the white hat would have deduced his hat's color in the first round, but since that didn't happen, my hat must be white!". However, the wise man with the black hat still cannot determine his hat's color. Thus, wise men 1 and 2 with white hats will be the first to deduce their hat colors, requiring two rounds of paper-revealing.