#include <bits/stdc++.h>
using namespace std;
void pikachu() {}
const int N = 200022;
int n, k;
int64_t dp[N], op[N];
int main() {
  pikachu();
  scanf("%d%d", &n, &k);
  char u;
  bool can;
  deque<int> q, p, r;
  p.push_back(0);
  dp[0] = 1000000000000000LL;
  r.push_back(0);
  for (int i = 1; i <= n; ++i) {
    scanf(" %c", &u), can = bool(u == '1');
    if (!q.empty() && q.front() < i - k) q.pop_front();
    if (!p.empty() && p.front() < i - k - 1) p.pop_front();
    if (!r.empty() && r.front() < i - k - 1) r.pop_front();
    op[i] = min(op[i - 1], dp[i - 1]) + i;
    if (!q.empty()) op[i] = min(op[i], dp[q.front()]);
    dp[i] = 1000000000000000LL;
    if (can) {
      if (!r.empty()) dp[i] = min(dp[i], i + dp[r.front()]);
      if (!p.empty()) dp[i] = min(dp[i], i + op[p.front()]);
    }
    while (!q.empty() && dp[q.back()] >= dp[i]) q.pop_back();
    while (!r.empty() && dp[r.back()] >= dp[i]) r.pop_back();
    while (!p.empty() && op[p.back()] >= op[i]) p.pop_back();
    q.push_back(i), p.push_back(i), r.push_back(i);
  }
  printf("%I64d", min(dp[n], op[n]));
}
