#include <iostream>

using namespace std;

int main(int argc, char** argv) {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cerr.tie(0);
	
	int h, n;
	
	cin >> h >> n;
	
	int arr[h][n];
	int res[h+1][n];
	
	for (int i = 0; i < h; i++){
		for (int j = 0; j < n; j++){
			if(i == 0){
				res[0][j] = 1;
			}
			cin >> arr[i][j];
		}
	}
	
	int startspace;
	int endspace;
	int sum;
	bool started;
	
	for (int i = 0; i < h; i++){
		
		startspace = 0;
		endspace = 0;
		sum = 0;
		started = false;
		
		for (int j = 0; j < n; j++){
			if (arr[i][j] == 1){
				res[i+1][j] = res[i][j];
				if (started){
					endspace = j-1;
					started = false;
					
					if (startspace == 0){
						res[i+1][j] += sum;
					}
					else {
						res[i+1][j] += sum/2;
						res[i+1][startspace - 1] += sum/2;
						if (sum % 2 != 0){
							if(i % 2 == 0){
								res[i+1][startspace - 1] ++;
							}
							else {
								res[i+1][j] ++;
							}
						}
					}
					sum = 0;
				}
			}
			else {
				if (!started){
					started = true;
					startspace = j;
				}
				sum += res[i][j];
				res[i+1][j] = 0;
				
				if (j == n-1){
					res[i+1][startspace - 1] += sum;
				}
			}
		}
	}
	
	for (int i = 0; i < n; i++){
		cout << res[h][i] << " ";
	}
	
	return 0;
}