Problem:
Score : 600 points

Problem Statement

Takahashi is playing a board game called Sugoroku.

On the board, there are N + 1 squares numbered 0 to N. Takahashi starts at Square 0, and he has to stop exactly at Square N to win the game.

The game uses a roulette with the M numbers from 1 to M. In each turn, Takahashi spins the roulette. If the number x comes up when he is at Square s, he moves to Square s+x. If this makes him go beyond Square N, he loses the game.

Additionally, some of the squares are Game Over Squares. He also loses the game if he stops at one of those squares. You are given a string S of length N + 1, representing which squares are Game Over Squares. For each i (0 \leq i \leq N), Square i is a Game Over Square if S[i] = 1 and not if S[i] = 0.

Find the sequence of numbers coming up in the roulette in which Takahashi can win the game in the fewest number of turns possible. If there are multiple such sequences, find the lexicographically smallest such sequence. If Takahashi cannot win the game, print -1.

Constraints

1 \leq N \leq 10^5

1 \leq M \leq 10^5

|S| = N + 1

S consists of 0 and 1.

S[0] = 0

S[N] = 0

Input

Input is given from Standard Input in the following format:

N M
S

Output

If Takahashi can win the game, print the lexicographically smallest sequence among the shortest sequences of numbers coming up in the roulette in which Takahashi can win the game, with spaces in between.

If Takahashi cannot win the game, print -1.

Sample Input 1

9 3
0001000100

Sample Output 1

1 3 2 3

If the numbers 1, 3, 2, 3 come up in this order, Takahashi can reach Square 9 via Square 1, 4, and 6. He cannot reach Square 9 in three or fewer turns, and this is the lexicographically smallest sequence in which he reaches Square 9 in four turns.

Sample Input 2

5 4
011110

Sample Output 2

-1

Takahashi cannot reach Square 5.

Sample Input 3

6 6
0101010

Sample Output 3

6

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Wrong Answer)

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
class Main{


	static final int MOD = 1000000007;

	static int MAX = 10000000;
	static	ArrayList<TreeNode> tree;
	static HashSet<Integer> set;
	static long ans;

	static HashSet<Integer> memo;
	static HashMap<Integer, TreeNode> map;


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力

		int n = sc.nextInt();
		int m = sc.nextInt();
		StringBuilder s = new StringBuilder(sc.next()).reverse();
		StringBuilder ans = new StringBuilder();

		
		for(int i = 0;i < s.length();i++){		//goal側から最大でstart側へ行ける場所を見つける

			for(int j = m;j >= 1;j--){
				if(i+j >= s.length()){		//はみ出し
					continue;
				}
				if(s.charAt(i+j) == '0'){		
					ans.append(j+" ");
					if(i+j == s.length()-1){
						ans.delete(ans.length()-1,ans.length());
						System.out.print(ans.reverse());
						return;
					}
					i += j-1;
					break;
				}
				if(j == 1){					//見つからない時は終わり
					System.out.println("-1");
					return;
				}
			}

		}






	}


	static boolean judge(int n){
		for(int i = 2;i*i <= n;i++){
			if(n%i == 0){
				return true;
			}
		}
		return false;
	}


	//
	//
	//	static long fac[] = new long[MAX];
	//	static long finv[] = new long[MAX];
	//	static long inv[] = new long[MAX];
	//
	//
	//
	//	//テーブルの作成
	//	static void COMinit() {
	//		fac[0] = fac[1] = 1;
	//		finv[0] = finv[1] = 1;
	//		inv[1] = 1;
	//		for (int i = 2; i < MAX; i++){
	//			fac[i] = fac[i - 1] * i % MOD;
	//			inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
	//			finv[i] = finv[i - 1] * inv[i] % MOD;
	//		}
	//	}
	//
	//	// 二項係数計算
	//	static	long COM(int n, int k){
	//		if (n < k) return 0;
	//		if (n < 0 || k < 0) return 0;
	//		return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	//	}
	//
	//






	static int upperbond(int k,ArrayList<Integer> data){		//k以下で最大の値をdataの中から探し、返す二分探索
		if(data == null){
			return -1;
		}
		int max = data.size();
		int min = -1;
		while(max-min > 1){
			int mid = (max+min)/2;
			if(data.get(mid) <= k){
				min = mid;
			}else{
				max = mid;
			}
		}


		//		if(min != -1){
		//			min = data.get(min);
		//		}

		//		System.out.println(max);
		return min;					//indexを返している
	}

	static int lowerbond(int k,ArrayList<Integer> data){		//k以上で最小の値をdataの中から探し、返す二分探索
		if(data == null){
			return -1;
		}
		//		System.out.println("lo");
		//		System.out.println("lo");
		int max = data.size();
		int min = -1;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data.get(mid) >= k){
				max = mid;
			}else{
				min = mid;
			}
		}

		return max;			//indexを返している
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}
}



class TreeNode{
	int value;
	ArrayList<TreeNode> children;
	boolean root;
	boolean fchild;

	public TreeNode(int value,ArrayList<TreeNode> children,boolean root) {
		this.value = value;
		this.children = children;
		this.root = root;
	}


}

class Pair implements Comparable{
	int from;
	int end;
	public Pair(int from,int end) {
		this.from = from;
		this.end = end;
		// TODO 自動生成されたコンストラクター・スタブ
	}

	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return  from - otherpair.from;
	}








}


class Data{

	long value;
	int num;
	public Data(long v,int n) {
		value = v;
		num = n;
		// TODO 自動生成されたコンストラクター・スタブ
	}
}