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

using namespace std;

int main()
{
	ifstream in("satellite.in");
	ofstream out("satellite.out");
	size_t n, k;
	in >> n >> k;
	assert (1 <= n && n <= 1000);
	assert (1 <= k && k <= 1000);

	set<int> was;
	int a[k][n];
	vector<pair<int, size_t>> events;
	for (size_t i = 0; i < k; i++) {
		for (size_t j = 0; j < n; j++) {
			in >> a[i][j];
			//assert (was.count(a[i][j]) == 0);
			//was.insert(a[i][j]);
			events.push_back(make_pair(a[i][j], i));
		}
	}
	sort(events.begin(), events.end());
	size_t ans[k];
	size_t count[k];
	fill(ans, ans + k, 0);
	fill(count, count + k, 0);
	size_t cnt = 0;
	for (auto e : events)	
		ans[e.second] += cnt++ - count[e.second]++;
	for (size_t i = 0; i < k; i++)
		out << ans[i] << (i == k - 1 ?  "" : " ");
	out << endl;
}
