Miniature Golf
A group of friends has just played a round of miniature golf. Miniature golf courses consist of a number of holes. Each player takes a turn to play each hole by hitting a ball repeatedly until it drops into the hole. A player’s score on that hole is the number of times they hit the ball. To prevent incompetent players slowing down the game too much, there is also an upper limit (a positive integer) on the score: if a player has hit the ball times without the ball dropping into the hole, the score for that hole is recorded as and that player’s turn is over. The total score of each player is simply the sum of their scores on all the holes. Naturally, a lower score is considered better.
There is only one problem: none of the players can remember the value of the integer . They decide that they will not apply any upper limit while playing, allowing each player to keep playing until the ball drops into the hole. After the game they intend to look up the value of and adjust the scores, replacing any score on a hole that is larger than with .
The game has just finished, but the players have not yet looked up . They wonder what their best possible ranks are. For this problem, the rank of a player is the number of players who achieved an equal or lower total score after the scores are adjusted with . For example, if the adjusted scores of the players are and , then their ranks are and respectively.
Given the scores of the players on each hole, determine the smallest possible rank for each player.
Input
The first line contains two integers and , where is the number of players and is the number of holes. The next lines each contain positive integers. The -th number on the -th of these lines is the score for player on hole and does not exceed .
Output
Output a line with the minimum possible rank for each player, in the same order as players are listed in the input.