#include <cstdio>
#include <fstream>
#include <vector>
#include <algorithm>
#include <set>
#include <cassert>

using namespace std;

vector< vector<int> > s;
vector<size_t> ans, g;
vector< pair<int, size_t> > a;

const int MAX_VALUE = 1e9;
int main()
{
	ifstream cin("satellite.in");
	ofstream cout("satellite.out");
	size_t n, k;
	cin >> n >> k;
	assert(1 <= n && n <= 1000);
	assert(1 <= k && k <= 1000);
	s.resize(k);
	ans.resize(k);
	g.resize(k);
    a.clear();
	for (size_t i = 0; i < k; ++i)
	{
		s[i].resize(n);
		for (size_t j = 0; j < n; ++j)
		{
			cin >> s[i][j];
            //assert(1 <= s[i][j] && s[i][j] <= MAX_VALUE);
			a.push_back(make_pair(s[i][j], i));
		}
	}
	sort(a.begin(), a.end());
	for (size_t i = 0; i < n * k; ++i)
	{
		ans[a[i].second] += (i - g[a[i].second]++);
	}
	for (size_t i = 0; i < k - 1; ++i)
		cout << ans[i] << " ";
	cout << ans[k - 1]; 
}
