#include <bits/stdc++.h>
using namespace std;
int n, k, state[200005];
long long f[200005];
void solve() {
  deque<int> q;
  q.push_back(0);
  for (int i = 1; i <= n; ++i) {
    while (!q.empty() && q.front() < i - 2 * k - 1) q.pop_front();
    f[i] = f[i - 1] + i;
    if (i - k >= 1 && state[i - k] && !q.empty())
      f[i] = min(f[q.front()] + i - k, f[i]);
    while (!q.empty() && f[q.back()] > f[i]) q.pop_back();
    q.push_back(i);
  }
  for (int i = n - k; i <= n; ++i) {
    while (!q.empty() && q.front() < i - k - 1) q.pop_front();
    if (state[i]) f[n] = min(f[n], f[q.front()] + i);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%1d", &state[i]);
  solve();
  printf("%I64d\n", f[n]);
}
