Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split()) 
s=list(input())

# dp[i]=iに行くのに最短の手数
dp=[0]*(n+1)
ans=0
now=n
count=0
flag=True
ans=[]
for i in range(10**11):
    if flag==False:
        break
    for j in range(m,0,-1):
        if s[now-j]!='1':
            if now-j<=0:
                ans.append(now)
                flag=False
                break
            else:
                ans.append(j)
                count+=1
                now-=j
                break
        else:
            if j==1:
                print(-1)
                exit()
            continue
        

ans.reverse()

print(*ans)
        

                
            
        
        
        

Fixed submission:
n,m=map(int, input().split()) 
s=list(input())

# dp[i]=iに行くのに最短の手数
dp=[0]*(n+1)
ans=0
now=n
count=0
flag=True
ans=[]
for i in range(10**11):
    if flag==False:
        break
    for j in range(m,0,-1):
        if now-j<=0:
            ans.append(now)
            flag=False
            break
        elif s[now-j]!='1':
            ans.append(j)
            count+=1
            now-=j
            break
        else:
            if j==1:
                print(-1)
                exit()
            continue
        

ans.reverse()

print(*ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split()) 
s=list(input())

# dp[i]=iに行くのに最短の手数
dp=[0]*(n+1)
ans=0
now=n
count=0
flag=True
ans=[]
for i in range (n+1):
    if flag==False:
        break
    for j in range(m,0,-1):

        if s[now-j]!='1':
            if now-j<=0:
                ans.append(now)
                flag=False
                break
            else:
                ans.append(j)
                count+=1
                now-=j
                break
        else:
            if j==1:
                print(-1)
                exit()
            continue
        

ans.reverse()

print(*ans)
        

                
            
        
        
        

Fixed submission:
n,m=map(int, input().split()) 
s=list(input())

# dp[i]=iに行くのに最短の手数
dp=[0]*(n+1)
ans=0
now=n
count=0
flag=True
ans=[]
for i in range(10**11):
    if flag==False:
        break
    for j in range(m,0,-1):
        if now-j<=0:
            ans.append(now)
            flag=False
            break
        elif s[now-j]!='1':
            ans.append(j)
            count+=1
            now-=j
            break
        else:
            if j==1:
                print(-1)
                exit()
            continue
        

ans.reverse()

print(*ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split()) 
s=list(input())

# dp[i]=iに行くのに最短の手数
dp=[0]*(n+1)
ans=0
now=n
count=0
flag=True
ans=[]
for i in range (n+1):
    if flag==False:
        break
    for j in range(m,0,-1):

        if s[now-j]!='1':
            if now-j<=0:
                ans.append(now)
                flag=False
                break
            else:
                ans.append(j)
                count+=1
                now-=j
                break
        else:
            if j==0:
                print(-1)
                exit()
            continue
        

ans.reverse()

print(*ans)
        

                
            
        
        
        

Fixed submission:
n,m=map(int, input().split()) 
s=list(input())

# dp[i]=iに行くのに最短の手数
dp=[0]*(n+1)
ans=0
now=n
count=0
flag=True
ans=[]
for i in range(10**11):
    if flag==False:
        break
    for j in range(m,0,-1):
        if now-j<=0:
            ans.append(now)
            flag=False
            break
        elif s[now-j]!='1':
            ans.append(j)
            count+=1
            now-=j
            break
        else:
            if j==1:
                print(-1)
                exit()
            continue
        

ans.reverse()

print(*ans)