#include <iostream>
using namespace std;
main ()
{
    int a,b,brk=0;
    cin>>a>>b;
    int reka[a][b];
    int voda[b];
    for (int i=0;i<a;i++)
    {
        for (int j=0;j<b;j++)
        {
        cin>>reka[i][j];
        }
    }
    for (int n=0;n<b;n++)
    {
        brk=0;
        if (reka[a-1][n]==0)
        {
            voda[n]=0;
        }
        if(reka[a-1][n]==1)
        {
            if(reka[a-1][n]=0)
            {
            if(reka[a-2][n+1]==1) brk+=1;
            if(reka[a-2][n-1]==1) brk+=1;
            voda[n]==brk;
            }
            else
            voda[n]==1;
        }
        else
            voda[n]==1;
        cout<<voda[n]<<endl;
    }
}