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

#define long int64_t
#define endl '\n'

#ifdef OFFLINE
	#define logan(...) logg(#__VA_ARGS__, __VA_ARGS__)
	template<class Arg>
	void logg(const char* name, Arg&& arg){ cerr << name << ": " << arg << '\n'; }
	template<class Arg, class ... Args>
	void logg(const char* name, Arg&& arg, Args&& ... args){
		char *next = (char*)name, *cand;
		int depth = 0;
		do{
			if(depth){ next = strchr(next+1, ')'); --depth; }
			else if((cand = strchr(next+1, '('))){ next = cand; ++depth; }
			else{ next = strchr(next+1, ','); }
		}while(depth);
		cerr.write(name, next-name) << ": " << arg << ",";
		logg(next+1, args...);
	}
	#define timeme 1.0*clock()/CLOCKS_PER_SEC
#else
	#define logan(...) {}
	#define timeme {}
#endif

int *w, *c;
int a[1'000'001];
int b[1'000'001];

int h, n;

#define W(x, y) *(w+(x)*n+(y))
#define C(x, y) *(c+(x)*n+(y))

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);
	
	cin >> h >> n;

	w = (int*)malloc(sizeof(int)*n*h);
	c = (int*)calloc(sizeof(int), n*(h+1));
	for(int i = 0; i < h; ++i)
	for(int j = 0; j < n; ++j)
		cin >> W(i, j);

	for(int i = 0; i < n; ++i) C(0, i) = 1; //a[i] = 1;
	for(int j = 0; j < h; ++j){
		//memset(b, 0, sizeof b);

		int l = -1;
		int r = -1;
		int ok = 0;
		int tot = 0;
		for(int i = 0; i < n; ++i){
			if(!ok)
				if(W(j, i)) C(j+1, i) += C(j, i); //b[i] += a[i];
				else { l = i-1; tot += C(j, i); ok = 1; }
			else{
				if(!W(j, i)){ tot += C(j, i); continue; }
				C(j+1, i) += C(j, i);
				ok = 0;
				r = i;

				if(l == -1){
					C(j+1, r) += tot;
					tot = 0;
					l = r = -1;
					continue;
				}

				C(j+1, l) += tot/2;
				C(j+1, r) += tot/2;
				if(tot%2) ++(j%2 ? C(j+1, r) : C(j+1, l));
				tot = 0;
				l = r = -1;
			}
		}

		if(ok) C(j+1, l) += tot;
		//swap(a, b);
	}

	//for(int i = 0; i < n; ++i) cout << a[i] << ' ';
	for(int i = 0; i < n; ++i) cout << C(h, i) << ' ';
	cout << endl;

	free(w);
}