#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 2, inf = 1e9 + 7;
void _run();
void no() { cout << "-1\n", exit(0); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  _run();
  return 0;
}
long long int n, k, T[4 * N], lz[4 * N];
void push_down(int nod, int st, int ed, long long int vl) {
  T[nod] = min(T[nod], vl);
  if (st != ed) {
    lz[2 * nod] = min(lz[2 * nod], vl);
    lz[2 * nod + 1] = min(lz[2 * nod + 1], vl);
  }
  lz[nod] = inf * inf;
}
void updt(int nod, int st, int ed, int l, int r, long long int vl) {
  if (lz[nod] != inf * inf) push_down(nod, st, ed, lz[nod]);
  if (st > ed || st > r || ed < l) return;
  if (st >= l && ed <= r) {
    T[nod] = min(T[nod], vl);
    if (st != ed) {
      lz[2 * nod] = min(lz[2 * nod], vl);
      lz[2 * nod + 1] = min(lz[2 * nod + 1], vl);
    }
    return;
  }
  int md = (st + ed) >> 1;
  updt(2 * nod, st, md, l, r, vl);
  updt(2 * nod + 1, md + 1, ed, l, r, vl);
  T[nod] = min(T[2 * nod], T[2 * nod + 1]);
}
long long int qry(int nod, int st, int ed, int l, int r) {
  if (st > ed || st > r || ed < l) return inf * inf;
  if (lz[nod] != inf * inf) push_down(nod, st, ed, lz[nod]);
  if (st >= l && ed <= r) return T[nod];
  int md = (st + ed) >> 1;
  return min(qry(2 * nod, st, md, l, r), qry(2 * nod + 1, md + 1, ed, l, r));
}
void _run() {
  cin >> n >> k;
  string s;
  cin >> s;
  long long int sm = 0;
  for (int i = 1; i <= 5 * n; i++) T[i] = lz[i] = inf * inf;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') {
      long long int rt = qry(1, 1, n, i, i);
      if (rt == inf * inf) rt = 0;
      updt(1, 1, n, i + 1, i + 1, rt + i + 1);
    } else {
      int mx = max(0LL, i - k);
      long long int rt = qry(1, 1, n, mx, mx);
      if (rt == inf * inf) rt = 0;
      updt(1, 1, n, max(1LL, i - k + 1), min(n, i + k + 1), rt + i + 1);
    }
  }
  cout << qry(1, 1, n, n, n) << "\n";
}
