#include <bits/stdc++.h>
using namespace std;
mt19937 rnd;
const int maxn = 2e5 + 10;
int nxt[maxn];
int asdfsdf[maxn];
bool s[maxn];
bool used[maxn];
long long dp[maxn];
long long t[4 * maxn];
const long long INF = 1e16;
void build(int v, int tl, int tr) {
  if (tl == tr)
    t[v] = dp[tl];
  else {
    int tm = (tl + tr) / 2;
    build(v * 2, tl, tm);
    build(v * 2 + 1, tm + 1, tr);
    t[v] = min(t[v * 2], t[v * 2 + 1]);
  }
}
long long getmin(int v, int tl, int tr, int l, int r) {
  if (l > r) return INF;
  if (l == tl && r == tr) return t[v];
  int tm = (tl + tr) / 2;
  return min(getmin(v * 2, tl, tm, l, min(r, tm)),
             getmin(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r));
}
void update(int v, int tl, int tr, int pos, long long new_val) {
  if (tl == tr)
    t[v] = new_val;
  else {
    int tm = (tl + tr) / 2;
    if (pos <= tm)
      update(v * 2, tl, tm, pos, new_val);
    else
      update(v * 2 + 1, tm + 1, tr, pos, new_val);
    t[v] = min(t[v * 2], t[v * 2 + 1]);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    char c;
    cin >> c;
    if (c == '1')
      s[i] = 1;
    else
      s[i] = 0;
  }
  asdfsdf[1] = -1;
  nxt[n] = -1;
  int cur = -1;
  if (s[1]) cur = 1;
  for (int i = 2; i <= n; i++) {
    if (s[i]) {
      asdfsdf[i] = cur;
      cur = i;
    } else {
      asdfsdf[i] = cur;
    }
  }
  cur = -1;
  if (s[n]) cur = n;
  for (int i = n - 1; i >= 1; i--) {
    if (s[i]) {
      nxt[i] = cur;
      cur = i;
    } else {
      nxt[i] = cur;
    }
  }
  if (s[1])
    nxt[0] = 1;
  else
    nxt[0] = nxt[1];
  for (int i = 1; i <= n; i++) dp[i] = INF;
  build(1, 1, n);
  dp[1] = 1ll;
  update(1, 1, n, 1, dp[1]);
  for (long long i = 2; i <= n; i++) {
    if (asdfsdf[i] == -1 && !s[i]) {
      dp[i] = dp[i - 1] + i;
    } else {
      int pos = nxt[max(0ll, i - k - 1)];
      if (pos <= i && pos != -1) {
        if (pos >= k + 2) {
          dp[i] =
              min(dp[i - 1] + i, pos + getmin(1, 1, n, pos - k - 1, pos - 1));
        } else {
          dp[i] = min(dp[i - 1] + i, (long long)pos);
        }
      } else {
        dp[i] = dp[i - 1] + i;
      }
    }
    update(1, 1, n, i, dp[i]);
  }
  cout << dp[n] << '\n';
  return 0;
}
