JOI '05 Final Round P1 - Questionnaire
View as PDFIOI highschool has a plan to go on a school excursion. To decide where to go, the student council
of the school has sent out a questionnaire to  students numbered 
 to 
, where 
.
There are 
 
 candidates numbered 
 to 
 for the destination of the excursion.
Students are asked to answer OK to those destinations they like, and NG to others.
Your task is to write a program which compute and output the destinations ordered according
to the preference the students made, that is, a destination is to appear before another if the
former has gained more OKs than the latter. If some destinations have gained the same number
of OKs, then they should be ordered according to their numbers.
Input
The first line of the file
contains two integers,  
 and 
 
, separated by a single space
character. The 
-st line represents the answer of 
-th student, where OK is denoted by 
1
and NG by 0. Those 1's and 0's should be separated by a space character. The -th 
0/1 is the
answer to the -th destination.
Output
The output should contain a single line containing  integers representing the destinations ordered according to the
preference.
Sample Input
4 6
1 0 1 0 1 1
1 1 0 1 0 0
1 1 1 0 0 0
1 0 1 0 1 0
Sample Output
1 3 2 5 4 6
Comments