using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] sl = s.Split(' ');
            int h = Convert.ToInt32(sl[0]);
            int n = Convert.ToInt32(sl[1]);
            int[,] a = new int[h, n];
            int[] x = new int[n];
            for(int i = 0; i<h;i++)
            {
                string r = Console.ReadLine();
                string[] rl = r.Split(' ');
                for(int j=0;j<n;j++)
                    a[i, j] =Convert.ToInt32(rl[j]);
            }
            int br=0,z=0;
            for (int i = 0; i < n; i++) x[i] = 1;
            for(int i = 0; i<h;i++)
                for(int j=0;j<n;j++)
                {
                    
                    if(a[i,j]==0)
                    {
                        br+=x[j];
                        x[j] = 0;
                        if(j!=n-1 && a[i,j+1]==0 ) z++;
                        else
                        {
                            if (j - z == 0)
                            {
                                x[j + 1] += br;
                                br = 0;
                            }
                            else
                            {
                                if (j == n - 1)
                                {
                                    x[j - z - 1] += br;
                                    br = 0;
                                }
                                else
                                {
                                    if (br % 2 == 0)
                                    {
                                        x[j + 1] += br / 2;
                                        x[j - z - 1] += br / 2;
                                        br = 0;
                                    }
                                    else
                                    {
                                        if ((i + 1) % 2 == 0)
                                        {
                                            x[j + 1] += br / 2 + (br % 2);
                                            x[j - z - 1] += br / 2;
                                            br = 0;
                                        }
                                        else
                                        {
                                            x[j - z - 1] += br / 2 + (br % 2);
                                            x[j + 1] += br / 2;
                                            br = 0;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            string p ="";
            for (int i = 0; i < n; i++) p += " " + x[i].ToString();
            Console.WriteLine(p);
        }
    }
}