import java.io.*;
import java.util.*;

public class satellite_sp_wrong implements Runnable {

	public static void main(String[] args) {
		new Thread(new satellite_sp_wrong()).run();
	}

	public void run() {
		try {
			Locale.setDefault(Locale.US);
			br = new BufferedReader(new FileReader(FILENAME + ".in"));
			out = new PrintWriter(FILENAME + ".out");
			solve();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	BufferedReader br;

	PrintWriter out;

	StringTokenizer st;

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(br.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	void myAssert(boolean e, String s) {
		if (!e) {
			throw new Error("Assertion failure " + s);
		}
	}

	private static final String FILENAME = "satellite";
	
	class Launch implements Comparable<Launch> {
		int time, n;

		@Override
		public int compareTo(Launch o) {
			return time - o.time;
		}
		
		Launch(int a, int b) {
			time = a;
			n = b;
		}
	}

	public void solve() throws IOException {
		int n = nextInt();
		int k = nextInt();
		Launch[] a = new Launch[n * k];
		for (int i = 0; i < k; i++) {
			for (int j = 0; j < n; j++) {
				a[i * n + j] = new Launch(nextInt(), i);
			}
		}
		Arrays.sort(a);
		int[] ans = new int[k];
		int[] cnt = new int[k];
		for (int i = 0; i < a.length; i++) {
			ans[a[i].n] += i - cnt[a[i].n];
			cnt[a[i].n]++;
		}
		for (int i = 0; i < k; i++) {
			out.print(ans[i] + " ");
		}
	}
}
