#include <iostream>
using namespace std;
//zadatak c

class Vodopad
{
public:
	//int  m[100][100];
	int** m;
	int maxv;
	int maxk;
	
	void setmax(int i, int j) {
		maxv = i;
		maxk = j;
		
		m = new int * [maxv];
		for (int i = 0; i < maxv; i++)
			m[i] = new int[maxk];
	}

	int imalevo(int nb, int i)
	{
		for (int k = i - 1; k >= 0; k--)
		{
			if (m[nb][k] != 0)
				return k;
		}
		return maxk;
	}

	int imadesno(int nb, int i)
	{
		for (int k = i + 1; k < maxk; k++)
		{
			if (m[nb][k] != 0)
				return k;
		};

		return maxk;
	}

	void printV(int kv, int kk) {
		for (int k1 = 0; k1 < kv; k1++)
		{
			for (int k2 = 0; k2 < kk; k2++)
			{
				cout << m[k1][k2] << ' ';
			}
			cout << '\n';
		}
	}
	void brisi() {
		for (int i = 0; i < maxv; i++)
			 delete[] m[i];
		delete[] m;
	}
};


int main() {

	int h, n, nb, hb, ml, md;
	int wl, wr;
	int p[10];
	Vodopad mV;

	cin >> h >> n;
	mV.setmax(h, n);

	for (int i = 0; i < n; i++) {
		p[i] = 1;
	}

	for (hb = 0; hb < h; hb++)
		for (nb = 0; nb < n; nb++) {
			cin >> mV.m[hb][nb];
		}

	
	for (hb = 0; hb < h; hb++) {
		for (nb = 0; nb < n; nb++) {
			
			if (mV.m[hb][nb] == 0) {
				wl = p[nb] / 2;
				wr = p[nb] / 2;

				if (p[nb] % 2 != 0) {
					if ((hb+1) % 2 == 0) {
						wr += 1;
					}
					else {
						wl += 1;
					}
				}

				ml = mV.imalevo(hb, nb);
				md = mV.imadesno(hb, nb);
		
				if ((ml != n) && (md != n)) {
					p[ml] = p[ml]+ wl;
					p[md] = p[md]+ wr;
			
				}
				else if (ml != n) {
					p[ml] += p[nb];
				}
				else
					p[md] += p[nb];

				p[nb] = 0;
			} // if m==0


		}

	}

	for (int i = 0; i < n; i++) {
		cout << p[i] << ' ';
	}

	mV.brisi();

	return 0;
}