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 C++14 (GCC 5.4.1) (judge verdict: Runtime Error)

#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#include <queue>
#include <map>
 
#define fir first
#define sec second
#define sz(s) (s).size()
#define pb push_back
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define prfi(n) printf("%d", &n);
#define prfd(n) printf("%lf", &n);
#define All(s) (s).begin(), (s).end()
#define rep(i,j,k) for(int (i)=(j);(i)<=(k);(i)++)
#define rep0(i,j) for(int (i)=0;(i)<(j);(i)++)
#define repdown(i, j, k) for(int (i)=(j);(i)>=(k);(i)--)
#define repdown0(i,j) for(int (i)=(j);i>=0;i--)
#define vfor(c,v) for(auto (c): v)
#define dump(x)  std::cout << #x << " = " << (x) << std::endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
using ll = long long;
using pii = std::pair<int,int>;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using namespace std;
 
const int Mod = (1e9) + 7;
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = 10241024;
const ll INFL = (1ll << 62) - 1;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
 
//_____________________________________Templates_________________________________________//
 
template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}
 
//mainly use for dynamic prog
template<class T1, class T2>
void update(T1 &a, T2 b){
  a += b;
  if(a > Mod) a %= Mod;
}
 
inline void IN(void){
  return;
}
 
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}
 
inline void OUT(void){
  cout << "\n";
  return;
}
 
template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}
 
template<class T>
struct segt{
  
  int n;
  T def;
  vector<T> dat;
  function<T(T, T)> operation;
  function<T(T, T)> update;
  
 
  segt(size_t _n, T _def, 
    function<T(T, T)> _operation, function<T(T, T)> _update) : def(_def), operation(_operation), update(_update)
    {
      n = 1;
      while (n < _n){
        n *= 2;
      }
      dat = vector<T>(2*n - 1, _def);
    }
 
  T _query(int a, int b, int k, int l, int r){
    if(r <=a  || b <= l)return def;
    if(a <= r && l <= b)return dat[k];
    else
    {
      T vl = _query(a, b, k*2 + 1, l, (l+r)/2);
      T vr = _query(a, b, k*2 + 2, (l+r)/2, r);
      return operation(vl, vr);
    }
  }
 
  T query(int a, int b){
    return _query(a,b, 0, 0, n);
  }
 
  void change(int i, T value){
    i += n - 1;
    dat[i] = update(dat[i], value);
    while(i > 0){
      i = (i - 1) / 2;
      dat[i] = operation(dat[i*2 + 1], dat[i*2 + 2]);
    }
  }
 
  T operator[](int i){
    return dat[i + n - 1];
  }
};
//__________________MP method_________//
template<class T>
struct MP {
  int n;
  vi a;
  T t;
  MP(){}
  MP(const T &t) : t(t){
    n = sz(t);
    a = vi(n+1);
    a[0] = -1;
    int j = -1;
    rep(i,0,n-1){
      while(j != -1 && t[j] != t[i])j = a[j];
      j++;
      a[i+1] = j;
    }
  }
  int operator[] (int i){
    return a[i];
  }
  vi findAll(const T& s){
    vi res;
    int j = 0;
    rep(i,0,sz(s)-1){
      if(j != -1 && s[i] != t[j])j = a[j];
      j++;
      if(j == n){
        res.pb(i-j+1);
        j = a[j];
      }
    }
    return res;
  }
};
 
//_____________________array calc____________________________________//
/*
vvi mul(vvi &A, vvi &B){
  vvi C(A.size(), vi(B.size()))
  rep(i,A.size()){
    rep(j,B.size()){
      rep(k,B[0].size()){
        C[i][j] = (C[i][j] A[i][k] + B[k][j]) % Mod;
      }
    }
  }
 
  return C;
}
 
vvi pow(vvi A, ll n){
  vvi B(A.size(), vi(A.size()));
  rep(i=0;i<A.size();i++){
    B[i][i] = 1;
  }
 
  while (n >0){
    if (n & 1) B = mul(B, A);
    A = mul(A, A);
    n = n >> 1;
  }
  return B;
}
*/
//_____________________Bynary Indexed Tree __________________________//
/*
struct BIT{
  #define bs (1 << 20)
  int bit[bs];
 
  int sum (int i){
    int s = 0;
    while(i > 0){
      s += bit[i];
      i -= i & -i;
    }
    return s;
  }
 
  void add(int i, int x){
    while(i <= n){
      bit[i] += x;
      i += i & -i;
    }
  }
}
*/
 
//____________________RMQ____________________________//
/*struct RMQ{
  #define s (1 << 20)
  ll dat[s];
  int n;
 
  void init(){
    memset(dat, -1e10, sizeof(dat));
  }
 
  void upd(int k, ll a){
    k += s/2 - 1;
    dat[k] = a;
    while(k > 0){
      k = (k -1) /2;
      dat[k] = max(dat[k*2+1], dat[k*2+2]);
    }
  }
 
  ll query(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) return -1e8;
    if( a <= l && r <= b)return dat[k];
    else 
    {
      ll vl = query(a, b, k*2+1, l, (l+r)/2);
      ll vr = query(a, b, k*2+2, (l+r)/2, r);
      return max(vl, vr);
    }
  }
 
  void Debug(int a){
    a += s/2 - 1;
    rep(i,s/2 - 1,a){
      dump(dat[i]);
    }
  }
};
*/
//_____________________　following sorce code_________________________//
int n,m,k,x,y;
//vvll dp(400, vll(400));
vll dp(1 << 16, -1e18);
string s;
vvll v(16, vll(16));
vll cost(1 << 16);
 
int main () {
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  IN(n,m,s);
  vi dp(n+1,INF);
  dp[n] = 0;
  repdown(i,n,0){
    if(s[i] == '1')continue;
    rep(j,1,m){
      if(i-j < 0)
      if(s[i-j] == '1')continue;
      chmin(dp[i-j], dp[i]+1);
      if(j == m)i = i - j;
    }
  }

  if(dp[0] == INF){
    OUT(-1);
    return 0;
  }
  vi ma;
  queue<int> q;
  q.push(0);
  int x = dp[0] - 1;
  rep(i,1,n){
  	if(dp[i] == INF)continue;
    if(x == dp[i]){
      int loc = q.front();
      q.pop();
      int ans = i - loc;
      x--;
      q.push(i);
      cout << ans << " ";
    }
  }
  return 0;
}