#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;

typedef pair<int,int> P;

struct great{
  bool operator()(const P& x, const P& y) const {
  	if(x.first == y.first) return x.second < y.second;
    return x.first > y.first;
  }
};

int main(){
	while(1){
		vector<pair<int,int> > vec;
		int n,m,s;
		cin >> n >> m;
		if(n == 0 && m == 0) return 0;
		
		for(int i = 0;i < m;i++) vec.push_back(make_pair(0,i + 1));
		for(int i = 0;i < n;i++){
			for(int j = 0;j < m;j++) {
				cin >> s;
				if(s == 1) vec[j].first++;
			}
		}
		sort(vec.begin(),vec.end(),great());
		cout << vec[0].second;
		for(int i = 1;i < m;i++) cout << " " << vec[i].second;
		cout << endl;
	}
	return 0;
}