#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, k;
long long dp[N], seg[N << 2];
char s[N];
void update(int rt, int l, int r, int ql, long long w) {
  if (ql == l && ql == r) {
    seg[rt] = w;
    return;
  }
  int mid = l + r >> 1;
  if (ql <= mid)
    update(rt << 1, l, mid, ql, w);
  else
    update(rt << 1 | 1, mid + 1, r, ql, w);
  seg[rt] = min(seg[rt << 1], seg[rt << 1 | 1]);
}
long long query(int rt, int l, int r, int ql, int qr) {
  if (l >= ql && r <= qr) {
    return seg[rt];
  }
  int mid = l + r >> 1;
  long long ans = 1e18;
  if (ql <= mid) ans = min(ans, query(rt << 1, l, mid, ql, qr));
  if (qr > mid) ans = min(ans, query(rt << 1 | 1, mid + 1, r, ql, qr));
  return ans;
}
int main() {
  scanf("%d %d", &n, &k);
  scanf("%s", s + 1);
  memset(seg, 0x3f, sizeof seg);
  memset(dp, 0x3f, sizeof dp);
  dp[0] = 0;
  update(1, 0, n, 0, 0);
  for (int i = 1; i <= n; i++) {
    if (s[i] == '0')
      dp[i] = min(dp[i], dp[i - 1] + i);
    else
      dp[min(i + k, n)] =
          min(dp[min(i + k, n)], query(1, 0, n, max(i - k - 1, 0), n) + i),
                    update(1, 0, n, min(i + k, n), dp[min(i + k, n)]);
    dp[i] = min(dp[i], query(1, 0, n, i + 1, n));
    update(1, 0, n, i, dp[i]);
  }
  printf("%lld\n", dp[n]);
  return 0;
}
