/*
	0161:Spoot Meet
*/
#include	<iostream>
#include	<vector>
#include	<algorithm>

using namespace std;

int main(void) {
	while(1) {
		int n, m;
		
		cin >> n >> m;
		if(n == 0 && m == 0) { break; }
		
		vector<int> pointTotal(m);
		vector<int> Nums(m);
		
		for(int i = 0; i < m; i++) {
			pointTotal[i] = 0;
			Nums[i] = i+1;
		}
		
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++) {
				int a;
				cin >> a;
				if(a == 1) { pointTotal[j]++; }
			}
		}
		
		for(int i = 0; i < m-1; i++) {
			for(int j = 0; j < m-1; j++) {
				if(pointTotal[j] < pointTotal[j+1]) {
					swap(pointTotal[j], pointTotal[j+1]);
					swap(Nums[j], Nums[j+1]);
				}
			}
		}
		
		for(int i = 0; i < m-1; i++) {
			cout << Nums[i] << ' ';
		}
		cout << Nums[m-1] << endl;
	}
	
	return 0;
}