unittest
{
	assert( [ "9 3", "0001000100" ].parse.expand.solve == "1 3 2 3" );
	assert( [ "5 4", "011110" ].parse.expand.solve == "-1" );
	assert( [ "6 6", "0101010" ].parse.expand.solve == "6" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nm = input.front.split.to!( long[] );
	input.popFront;
	auto s = input.front.map!( ( a ) => ( a - '0' ).to!( long ) ).array;
	return tuple( nm[ 1 ], s );
}

auto solve( long m, long[] s )
{
	long[] anss;
	auto p = s.length.signed - 1;
	while( 0 < p )
	{
		auto d = min( m, p );
		while( 0 < d && s[ p - d ] ) d--;
		if( d == 0 ) return "-1";
		p -= d;
		anss ~= d;
	}
	return anss.to!( string[] ).retro.join( ' ' );
}
