#include <bits/stdc++.h>
#define MAX_SIZE 1000001

bool vodopad[MAX_SIZE][MAX_SIZE];
int sol[MAX_SIZE];
int h, n;

void solution(int stena_p, int stena_k, int i, int c)
{
	if(stena_p == -1 || stena_k == -1) return;
	
	if(stena_p == 0) sol[stena_k + 1] += c;
	else if(stena_k == n - 1) sol[stena_p - 1] += c;
	else 
	{
		if(c % 2 != 0 && (i + 1) % 2 == 0) sol[stena_p - 1] += c / 2, sol[stena_k + 1] += c / 2 + 1;
		else if((c % 2 != 0 && (i + 1) % 2 != 0)) sol[stena_p - 1] += c / 2 + 1, sol[stena_k + 1] += c / 2;
		else sol[stena_p - 1] += c / 2, sol[stena_k + 1] += c / 2;
	}
}

int main()
{
	scanf("%d%d", &h, &n);

	for(int i = 0; i < h; i++)
		for(int j = 0; j < n; j++)
		{
			int c;
			scanf("%d", &c);
			vodopad[i][j] = c ? true : false;
			if(i == 0) sol[j] = 1;
		}
		
	for(int i = 0; i < h; i++)
	{
		int stena_p = -1, stena_k = -1;
		int c = 0;
		
		for(int j = 0; j < n; j++)
		{
			if(stena_p == -1 && vodopad[i][j] == false) stena_p = j, stena_k = j, c += sol[j], sol[j] = 0;
			else if(vodopad[i][j] == false) stena_k = j, c += sol[j], sol[j] = 0;
			else solution(stena_p, stena_k, i, c), stena_p = -1, stena_k = -1, c = 0;
		}	
		if(stena_p == -1) continue;
		if(c > 0) solution(stena_p, stena_k, i,c);
	}
	for(int i = 0; i < n; i++)
		printf("%d ", sol[i]);
	putchar('\n');
}