#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) 
{
	int n, h, i, j, levi, desni, s = 0;
	bool slevo = false, ima = false;
	cin >> h >> n;
	int vodopad[h][n], rez[h+1][n];
	for(i = 0; i < h; i++)
	{
		for(j = 0; j < n; j++)
			cin >> vodopad[i][j];
	}
	for(j = 0; j < n; j++) rez[0][j] = 1;
	for(i = 0; i < h; i++)
	{
		for(j = 0; j < n; j++)
		{
			if(vodopad[i][j] == 0)
			{
				rez[i+1][j] = 0;
				s += rez[i][j];
				if(j != 0)
				{
					if(vodopad[i][j-1] == 1)  levi = j-1;
				}
				else levi = -1;
				if(j+1 == n)
				{
					rez[i+1][levi] += s;
					s = 0;
					ima = false;
				}
				ima = true;
			}
			else
			{
				rez[i+1][j] = rez[i][j];
				if(ima)
				{
					if(levi == -1) rez[i+1][j] += s;
					else
					{
						if(s % 2 == 0)
						{
							rez[i+1][levi] += s/2; rez[i+1][j] += s/2;
						}
						else
						{
							if((i+1) % 2 == 0)
							{
								rez[i+1][levi] += s/2; rez[i+1][j] += s/2 + 1;
							}
							else
							{
								rez[i+1][levi] += s/2 + 1; rez[i+1][j] += s/2;
							}
						}
					}
					s = 0;
					ima = false;
				}
			}
		}
		s = 0;
		ima = false;
	}
	for(j = 0; j < n; j++) cout << rez[h][j] << " ";
	return 0;
}