#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
int n, k, a[MAXN], q[MAXN], qhead = 1, qtail = 1, p[MAXN], phead = 1, ptail;
long long f[MAXN][2];
int read() {
  int sss = 0, fff = 1;
  char ccc;
  ccc = getchar();
  while (ccc < '0' || ccc > '9') {
    if (ccc == '-') fff = -1;
    ccc = getchar();
  }
  while (ccc >= '0' && ccc <= '9')
    sss = (sss << 1) + (sss << 3) + (ccc ^ '0'), ccc = getchar();
  return sss * fff;
}
int R() {
  char ccc = getchar();
  while (ccc < '0' || ccc > '9') ccc = getchar();
  return ccc - '0';
}
int main() {
  memset(f, 0x3f, sizeof(f));
  n = read();
  k = read();
  for (int i = 1; i <= n; i++) a[i] = R();
  f[0][0] = 0;
  for (int i = 1; i <= n; i++) {
    f[i][0] = min(f[i][0], f[i - 1][0] + i);
    while (phead <= ptail && p[phead] + k < i) phead++;
    if (phead <= ptail) f[i][0] = min(f[i][0], f[p[phead]][1]);
    while (qhead < qtail && q[qhead] + k + 1 < i) qhead++;
    if (a[i]) {
      f[i][1] = min(f[i][1], f[q[qhead]][0] + i);
      while (phead <= ptail && f[p[ptail]][1] >= f[i][1]) ptail--;
      p[++ptail] = i;
    }
    while (qhead <= qtail && f[q[qtail]][0] >= f[i][0]) qtail--;
    q[++qtail] = i;
  }
  printf("%lld", min(f[n][0], f[n][1]));
  return 0;
}
