#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
struct T{int n, p;};
int main()
{
	int a, n, m, i, j;
	while (cin >> n >> m)
	{
		if (n == 0 && m == 0) break;
		T p[100] = {{0, 0}}, t;
		for (i = 0; i < m; i++)
			p[i].n = i+1, p[i].p = 0;
		for (i = 0; i < n; i++)
		{
			for (j = 0; j < m; j++)
			{
				cin >> a;
				if (a == 1) p[j].p++;
			}
		}
		for (i = 0; i < m; i++)
			for (j = 0; j < m-1; j++)
				if (p[j].p < p[j+1].p)
					t = p[j], p[j] = p[j+1], p[j+1] = t;
		for (i = 0; i < m; i++)
		{
			cout << p[i].n;
			if (i < m-1)
				cout << " ";
		}
		cout << endl;
	}
}