#include <bits/stdc++.h>

using namespace std;

struct struka
{
    int x;
    int vr;
};

typedef vector<struka> vs;
typedef vector<vs> vvs;

int main()
{
    int n, m, i, k, stl, sum;
    cin>> n>> m;
    vvs mata(n+1, vs(m));
    for(i=0; i<n; i++)
        for(k=0; k<m; k++)cin>> mata[i][k].x;
    for(k=0; k<m; k++)mata[0][k].vr=1;
    for(i=0; i<n; i++)
        for(k=0; k<m; k++)
        { if(mata[i][k].x==1)mata[i+1][k].vr+=mata[i][k].vr;
          else
          { sum=0; stl=k;
            while(mata[i][k].x==0&&k<m)
            { sum+=mata[i][k].vr;
              k++;
            } k--;
            if(k==m-1)mata[i+1][stl-1].vr+=sum;
            else if(stl==0)mata[i+1][k+1].vr+=sum;
            else if(i%2==0)
            { mata[i+1][stl-1].vr+=sum-sum/2;
              mata[i+1][k+1].vr+=sum/2;}
            else
            { mata[i+1][stl-1].vr+=sum/2;
              mata[i+1][k+1].vr+=sum-sum/2;}
          }
        }
    for(k=0; k<m; k++)cout<< mata[n][k].vr<<' ';

    return 0;
}