#include <bits/stdc++.h>
#include <iostream>
using namespace std;

int main()
{
	int h, n;
	cin >> h >> n;
	int** mat = new int*[h];

	for (int i = 0; i < h; i++)
	{
		mat[i] = new int[n];
		for (int j = 0; j < n; j++)
		{
			cin >> mat[i][j];
		}
	}

	int* niz = new int[n];
	int* tmp = new int[n];
	for (int i = 0; i < n; i++)
		niz[i] = 1;
	for (int i = 0; i < n; i++)
		tmp[i] = 0;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (mat[i][j] == 0)
			{
				if (mat[i][j + 1] == 0)
				{
					niz[j + 1] += niz[j];
					continue;
				}
				if (j == 0)
				{
					tmp[1] += niz[0];
					continue;
				}
				else if (j == n - 1)
				{
					tmp[n - 2] += niz[n - 1];
					continue;
				}
				if (niz[j] % 2 != 0)  //ovde
				{
					if (i % 2 == 0)
					{
						tmp[j + 1] += niz[j] / 2 + 1;
						tmp[j - 1] += niz[j] / 2;
					}
					else
					{
						tmp[j - 1] += niz[j] / 2 + 1;
						tmp[j + 1] += niz[j] / 2;
					}
				}
				else
				{
					tmp[j - 1] += niz[j] / 2;
					tmp[j + 1] += niz[j] / 2;
				}
			}
			else
			{
				tmp[j] += niz[j];
			}
		}
		for (int k = 0; k < n; k++)
		{
			niz[k] = tmp[k];
			tmp[k] = 0;
		}
	}

	cout << endl;
	for (int i = 0; i < n; i++)
		cout << niz[i] << " ";

	delete niz;
	delete tmp;
	for (int i = 0; i < h; i++)
		delete mat[i];
	delete mat;

	return 0;
}