#include<iostream>
#include<vector>
using namespace std;

int h, w, i, j, k, l, d, n, m, p, levo, desno;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> h >> w;
	vector<vector<int>> mat(h + 2, vector<int>(w + 2));
	vector<vector<int>> voda(h + 2, vector<int>(w + 2, 0));

	//for (i = 0; i < h + 3; i++) {
	//	mat[i][0] = mat[i][w + 1] = INT_MAX;
	//}
	for (i = 1; i <= h; i++) {
		for (j = 1; j <= w; j++) {
			cin >> mat[i][j];
			if(mat[i][j]<1)mat[i][j]--;
			if (mat[i][j - 1] < 0 && mat[i][j] < 0)mat[i][j] = mat[i][j - 1] - 1;
		}
	}

	
	for (i = 1; i <= w; i++) {
		voda[1][i] = 1;
	}

	for (i = 1; i <= h; i++) {
		for (j = 1;; j++) {
			voda[i][j] += voda[i][j - 1];
			if (mat[i][j] > 0)break;
		}
		l = j;

		for (j = w;; j--) {
			voda[i][j] += voda[i][j + 1];
			if (mat[i][j] > 0)break;
		}
		d = j;
		

		n = 0;
		for (j = l; j <= d; j++) {
			if (mat[i][j]==1) {
				voda[i + 1][j] += voda[i][j]+n;
				n = 0;
			}
			else {
				p = voda[i][j] & 1;
				levo = voda[i][j] / 2;
				desno = voda[i][j] / 2;

				if (i & 1) levo += p;
				else desno += p;

				voda[i + 1][j + mat[i][j]] += levo;
				n += desno;
			}
		}
	}

	for (i = 1; i <= w; i++) {
		cout << voda[h + 1][i] << ' ';
	}
}