beecrowd | 2902

Rouba Monte

Por BR Brazil

Timelimit: 1

One of the funniest card games for toddlers, for the simplicity, is Rouba Monte. The game uses one or more standard decks and has very simple rules. Letters are distinguished only by value (ace, two, three, ...), ie card suits are not considered (eg ace of clubs and gold ace have the same value). Initially the cards are shuffled and placed in a stack at the game table, called purchase stack, face down. During the game, each player keeps a the pile of cards face up; at any given time a player's pile may contain zero or more cards. At the beginning of the game, all the piles of the players have zero cards. Next to the shopping stack is a designated area of ​​discard area, initially empty, and all cards placed in the discard area are placed side-by-side with the face up (ie they are not stacked). Players, arranged in a circle around the game table, play sequentially, clockwise. The plays proceed as follows:

• The player who has the turn to play removes the card from the top of the purchase stack and shows it to the other players; Let's call this card of card of turn.

• If the card of turn is equal to any card present in the discard area, the player removes that card from the discarding area by placing it, along with the card of turn, at the top of pile, face up, and continues the move (ie, removes another card from the purchase stack and repeats the process).

• If the card of turn is equal to the top card of a pile of another player, the player "steals" that pile, stacking it in its own pile, places the turn card on top of its pile face up, and continues the move.

• If the card of turn is equal to the card at the top of its own pile, the player places the turn card at the top of its own mound, face up, and continues the move.

• If the card of turn is different from the cards from the discard area and the cards at the tops of the piles, the player places it in the discard area, face up, and the play ends (ie the next player makes his move ). Note that this is the only case where the player does not continue the move. The game ends when there are no more cards in the purchase stack. The player with the highest pile (the pile containing the highest number of cards) wins the game. If there is a tie, all the players with the mound containing the highest number of cards win the game.

Input

A entrada é composta de vários casos de teste. A primeira linha de um caso de teste contém dois inteiros N and J, representing respectively the number of cards in the deck (2 ≤ N ≤ 10.000) and the number of players (2 ≤ J ≤ 20 and JN). The cards in the deck are represented by integers from 1 to 13 and players are identified by integers from 1 to J. The first player to play is the player 1, followed by palyer 2, . . ., followed by player J, followed by player 1, followed by player 2, and so on as long while there are cards in the purchase stack. The second line of a test case contains N integers between 1 and 13, separated by a blank space, representing the cards in the stack. The cards are taken from the purchase stack in the order they appear in the entry. The end of the entry is indicated by a line with N = J = 0.

Output

For each test case your program should print a line containing the number of cards from the player's pile or players who won the match followed by a blank followed by the identifier (s) of the players who won the match. If there is more than one winning player, print the player identifiers in ascending order, separated by a space.

Input Sample Output Sample

4 2

10 7 2 5

6 3

1 2 1 2 1 2

8 2

3 3 1 1 2 3 4 5

0 0

0 1 2

5 1

3 2