import java.util.Scanner;

public class Vodopad {

	public static int kolikoPrvihSuStene(byte[][] matrica, int k, int l) {
		int n = 0;
		for (int i = l; i < matrica[k].length; i++) {
			if (matrica[k][i] == 0) {
				n++;
			} else {
				break;
			}
		}
		return n;
	}

	public static int saberi(int[][] matrica, int k, int w, int l) {
		int p = 0;
		int n = l;
		while (n < l + w) {
			p = p + matrica[k][n];
			n++;
		}
		return p;
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int h = scan.nextInt();
		int n = scan.nextInt();
		byte[][] matrica = new byte[h][n];
		for (int qw = 0; qw < h; qw++) {
			for (int wq = 0; wq < n; wq++) {
				matrica[qw][wq] = scan.nextByte();
			}
		}

		int[][] matrica1 = new int[h + 1][n];
		for (int j = 0; j < n; j++) {
			matrica1[0][j] = 1;
		}
		int w;
		int p;

		for (int i = 0; i < h; i++) {

			int k = 0;
			while (k < n) {

				if (k == 0) {
					w = kolikoPrvihSuStene(matrica, i, k);

					if (w == 0) {
						matrica1[i + 1][k] = matrica1[i + 1][k] + matrica1[i][k];
						k++;

					} else {
						p = saberi(matrica1, i, w, k);
						matrica1[i + 1][k] = 0;
						matrica1[i + 1][k + w] = matrica1[i + 1][k + w] + p;
						k = k + w;

					}
				} else {
					w = kolikoPrvihSuStene(matrica, i, k);
					if (w == 0) {
						matrica1[i + 1][k] = matrica1[i + 1][k] + matrica1[i][k];
						k++;

					} else {
						p = saberi(matrica1, i, w, k);
						if (k + w > n - 1) {
							matrica1[i + 1][k - 1] = matrica1[i + 1][k - 1] + p;
							k = k + w;
						} else {
							if (i % 2 == 0) {
								matrica1[i + 1][k + w] = matrica1[i + 1][k + w] + p / 2;
								matrica1[i + 1][k - 1] = matrica1[i + 1][k - 1] + p - p / 2;
								k = k + w;
							} else {
								matrica1[i + 1][k + w] = matrica1[i + 1][k + w] + p - p / 2;
								matrica1[i + 1][k - 1] = matrica1[i + 1][k - 1] + p / 2;
								k = k + w;
							}
						}
					}
				}
			}
		}

		for (int wqw = 0; wqw < n; wqw++) {
			System.out.print(matrica1[h][wqw] + " ");
		}
	}
}