#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ZERO(a) memset(a,0,sizeof(a))

int n,m;
int a[120];

int main() {
    while(cin>>n>>m && n) {
        ZERO(a);
        rep(i,n) rep(j,m) {
            int t;
            scanf("%d", &t);
            if(t == 1) ++a[j];
        }
        int b[120] = {0};
        rep(i,m) b[i] = i+1;

        rep(i,m) rep(j,m-1) if(a[j] < a[j+1]) {
            swap(a[j], a[j+1]);
            swap(b[j], b[j+1]);
        }

        rep(i,m) {
            cout << b[i];
            if(i != m-1) cout << " ";
        }
        puts("");
    }

    return 0;
}