#include <iostream>
#include <string>
#include <algorithm>
#include <limits>
#include <iomanip>
#include <cmath>

using namespace std;

typedef numeric_limits<streamsize> ignore_t;

int main()
{
	int h{}; 
	int n{}; 

	scanf_s("%d %d", &h, &n);

	int **vodopad = new int*[h + 1];
	int **protok  = new int*[h + 1];

	protok[0] = new int[n + 1];
	for (int i{ 1 }; i <= n; ++i)
		protok[0][i] = 1;

	for (int i{1}; i <= h; ++i) 
	{
		vodopad[i] = new int[n + 1];
		protok[i]  = new int[n + 1];
		for (int j{1}; j <= n; ++j) 
		{
			protok[i][j] = 0;
			cin >> vodopad[i][j];
			
		}
		cin.ignore(ignore_t::max(), '\n');
	}

	for (int i{1}; i <= h; ++i) 
	{
		for (int j{1}; j <= n; ++j) 
		{
			
			switch (vodopad[i][j]) 
			{
			case 1:
			{
				protok[i][j] += protok[i - 1][j];
				break;
			}
			case 0:
			{
				if (j-1 < 1) 
				{
					int temp{ protok[i-1][j] };
					int br_nula{ 1 };
					for (int jj{ j+1 }; jj <= n; ++jj) 
					{
						if (!(vodopad[i][jj]))
						{
							++br_nula;
							temp += protok[i - 1][jj];
						}
						else 
						{
							protok[i][j + br_nula] += temp;
							break;
						}		
					}	
				}
				else if (j + 1 > n) 
				{
					int temp{ protok[i - 1][j] };
					int br_nula{ 1 };
					for (int jj{ j-1 }; jj >= 0; --jj)
					{
						if (!(vodopad[i][jj]))
						{
							++br_nula;
							temp += protok[i - 1][jj];
						}
						else
						{
							protok[i][j - br_nula] += temp;
							break;
						}
					}
				}
				else 
				{
					int temp{ protok[i - 1][j] };
					int br_nula{ 1 };

					for (int jj{ j + 1 }; jj <= n; ++jj)
					{
						if (!(vodopad[i][jj]))
						{
							++br_nula;
							temp += protok[i - 1][jj];
						}
						else
						{
							break;
						}
					}

					if (temp % 2 == 0) 
					{
						if (j + br_nula > n) 
						{
							protok[i][j - 1] += temp;
							j = n;
						}
						else 
						{
							protok[i][j - 1] += (temp / 2);
							protok[i][j + br_nula] += (temp / 2);
							j = j + br_nula - 1;
						}
					}
					else if (temp % 2 == 1) 
					{
						if (j + br_nula > n) 
						{
							protok[i][j - 1] += temp;
							j = n;
						}
						else 
						{
							if (temp == 1) 
							{
								if (i % 2 == 0)
								{
									protok[i][j + 1] += temp;
								}
								if (i % 2 == 1)
								{
									protok[i][j - 1] += temp;
								}
							}
							else 
							{
								protok[i][j - 1] += (temp / 2);
								protok[i][j + br_nula] += (temp / 2);

								if (i % 2 == 0)
								{
									protok[i][j + br_nula] += (temp % 2);
								}
								if (i % 2 == 1)
								{
									protok[i][j - 1] += (temp % 2);
								}
								j = j + br_nula - 1;
							}
						}
						
					}
					break;
				}
			}
			}
		}
	}

	for (int j{ 1 }; j <= n; ++j)
	{
		cout << protok[h][j] << ' ';
	}

	cin.clear();
	cin.ignore(ignore_t::max(), '\n');
	cin.get();

	return 0;
}