class SkewHeap
  def initialize(rev = nil)
    @rev = rev
  end
  def push(k)
    @root = meld(@root, Node.new(k))
  end
  def top
    @root.key
  end
  def empty?
    @root == nil
  end
  def pop
    key = @root.key
    @root = meld(@root.lchild, @root.rchild)
    key
  end
  def meld(lhs, rhs)
    return lhs unless rhs
    return rhs unless lhs
    lhs, rhs = rhs, lhs unless lhs.key < rhs.key
    lhs, rhs = rhs, lhs if @rev && lhs.key < rhs.key
    lhs.rchild = meld(lhs.rchild, rhs)
    lhs.lchild, lhs.rchild = lhs.lchild, lhs.rchild
    lhs
  end
  class Node
    attr_accessor :key, :lchild, :rchild
    def initialize(k)
      @key = k
    end
  end
end

class Tuple
  include Comparable
  attr_accessor :val
  def initialize(*val)
    @val = val
  end
  def <=>(t)
    @val.zip(t.val).each do |l, r|
      return l <=> r if l != r
    end
    0
  end
end

N,M=gets.split.map(&:to_i)
S=gets.chop
q=SkewHeap.new
q.push(Tuple.new(0, 0, 0))
d=Array.new(N+1){-1}
until q.empty?
  w,s,v=q.pop.val
  next if d[v]!=-1
  d[v]=s
  1.upto(M) do |i|
    next unless v+i <= N
    next if S[v+i]==?1
    q.push(Tuple.new(w+1, 10*s+i, v+i))
  end
end
puts d[N]<0 ? -1 : d[N].to_s.chars*" "