import java.util.*;
import java.lang.*;

public class Zadatak {

    public static void main(String[] args) {
 Scanner skener = new Scanner(System.in);
        int h = skener.nextInt(), w = skener.nextInt();

        int[][] hw = new int[h][w];
        int[] resenje = new int[w];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                hw[i][j] = skener.nextInt();

            }
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (hw[i][0] == 1) {
                    if (hw[i + 1][j] == 0) {
                        resenje[j]+=1;
                    } else if (hw[i + 1][j + 1] == 0) {
                        resenje[j]=1;
                    } else if (hw[i][w - 1] == 1) {
                        if (hw[i + 1][j] == 0) {
                            resenje[j]+=1;
                        } else if (hw[i + 1][j - 1] == 0) {
                            resenje[j]=1;
                        }
                    }
                } else if ((hw[i+1][j] == 0) && (w % 2 == 1)) {
                    resenje[j]+=1;
                } else if ((hw[i+1][j] == 0) && (w % 2 == 0)) {
                    resenje[j]+=1;
                }

            }
        }

        for (int j = 0; j < w; j++) {
            System.out.println(resenje[j]);
        }


    }


}