#include <iostream>

int voda[10000000] = {1};

typedef struct stena
{
	int x = 0;
	int w = 0;
	int k = 0;
} Stena;
Stena stene[10000000];

int main()
{
	int n, h;
	int x, w, k;
	scanf("%d%d", &h, &n);
	for(int i = 0;i<n;i++)
	{
		voda[i] = 1;
	}
	for(int i = 0;i<h;i++)
	{
		int bs = 0;
		for(int j = 0;j<n;j++)
		{
			int tren;
			scanf("%d", &tren);
			if(tren==0)
			{
				stene[bs].w++;
				stene[bs].k+=voda[j];
			}
			else if(stene[bs].w>0)
			{
				stene[bs].x = j-stene[bs].w;
				bs++;
			}
		}
		if(stene[bs].w>0)
		{
			stene[bs].x = n-stene[bs].w;
			bs++;
		}
		for(int l = 0;l<bs;l++)
		{
			for(int m = 0;m<stene[l].w;m++)
			{
				voda[m+stene[l].x] = 0;
			}
			if(stene[l].x==0)
			{
				voda[stene[l].w] +=stene[l].k;
			}
			else if(stene[l].x+stene[l].w==n)
			{
				voda[stene[l].x-1] += stene[l].k;
			}
			else
			{
				voda[stene[l].x-1]+=stene[l].k/2;
				voda[stene[l].x+stene[l].w]+=stene[l].k/2;
				if(stene[l].k - (stene[l].k/2)*2==1)
				{
					if(i%2==0)
					{
						voda[stene[l].x-1]++;
					}
					else
					{
						voda[stene[l].x+stene[l].w]++;
					}
				}
			}
			stene[l].x = 0;
			stene[l].w = 0;
			stene[l].k = 0;
		}
	}
	for(int i = 0;i<n;i++)
	{
		printf("%d ", voda[i]);
	}
	return 0;
}