require 'matrix'

def get_integers
    gets.split(" ").map(&:to_i)
end

loop {
    n, m = get_integers
    break if n == 0
    count = (1..n).map{Vector[*get_integers]}.inject(&:+)
    puts (1..m).sort_by{|i| [-count[i-1], i]}.join(" ")
}   