#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long l;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long n,m;
    cin >> n >> m;
    l** a=(l**)malloc((n+1)*sizeof(l*));
    for (l i=0;i<=n;i++)
        a[i]=(l*)malloc(m*sizeof(l));
    l** b=(l**)malloc((n+1)*sizeof(l*));
    for (l i=0;i<=n;i++)
        b[i]=(l*)calloc(m,sizeof(l));


    for (l i=1;i<=n;i++)
        for (l j=0;j<m;j++)
        cin >> a[i][j];

    for (l i=0;i<m;i++)
    {
        a[0][i]=1;
        b[0][i]=1;
    }

    l left=0;
    l right=0;




     for (l i=0;i<n;i++)
     {
         left=-1;
         right=0;
        for (l j=0;j<m;j++)
        {
            if (a[i+1][j]==0)
            {
                if (left!=-1)
                {
                    b[i+1][left]+=b[i][j]/2;
                    if ((i+1) % 2==1) b[i+1][left]+=b[i][j]%2;
                    else right+=b[i][j]%2;
                    right+=b[i][j]/2;
                }
                else
                {
                    right+=b[i][j];
                }
            }
            else
            {
                left=j;
                b[i+1][j]+=right;
                b[i+1][j]+=b[i][j];
                right=0;
            }
        }
        b[i+1][left]+=right;
     }



        for (l j=0;j<m;j++)
            cout << b[n][j] << " ";



    return 0;
}