#include<iostream>
#include<utility>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	while (true) {
		int n, m;
		cin >> n >> m;
		if (n == 0 && m == 0) {
			break;
		}

		vector<pair<int, int> > a(m);
		for (int i = 0; i < m; ++i) {
			a[i].first = i + 1;
		}
		for (int i = 0; i < n; ++i) {
			for (auto& temp : a) {
				int b;
				cin >> b;
				if (b != 0) {
					++temp.second;
				}
			}
		}
		struct func {
			bool operator()(pair<int, int> x, pair<int, int> y) {
				return x.second > y.second;
			}
		};

		stable_sort(a.begin(), a.end(), func());

		for (auto it = a.begin(); it != a.end(); ++it) {
			if (it != a.begin()) {
				cout << " ";
			}
			cout << it->first;
		}
		cout << endl;
	}
	return 0;
}