#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7;
inline int add(int a, int b) {
  if ((a += b) >= P) a -= P;
  return a;
}
inline int sub(int a, int b) {
  if ((a -= b) < 0) a += P;
  return a;
}
inline int mul(int a, int b) { return 1ll * a * b % P; }
inline int kpow(int a, int b) {
  int r = 1;
  for (; b; b >>= 1, a = mul(a, a)) {
    if (b & 1) r = mul(r, a);
  }
  return r;
}
const int N = 202020;
int n, m;
char s[N];
namespace SegTree {
const int N = 202020, M = N << 2;
const long long INF = 1e18 + 7;
long long lzy[M], mn[M];
void up(int id) { mn[id] = min(mn[id << 1], mn[id << 1 | 1]); }
void down(int id, int nl, int nr) {
  int mid = nl + nr >> 1;
  if (lzy[id]) {
    mn[id << 1] = min(mn[id << 1], lzy[id]);
    mn[id << 1 | 1] = min(mn[id << 1 | 1], lzy[id]);
    if (!lzy[id << 1]) lzy[id << 1] = lzy[id];
    if (!lzy[id << 1 | 1]) lzy[id << 1 | 1] = lzy[id];
    lzy[id << 1] = min(lzy[id << 1], lzy[id]);
    lzy[id << 1 | 1] = min(lzy[id << 1 | 1], lzy[id]);
    lzy[id] = 0;
  }
}
void build(int id, int nl, int nr) {
  if (nl == nr) {
    mn[id] = INF;
    return;
  }
  int mid = nl + nr >> 1;
  build(id << 1, nl, mid);
  build(id << 1 | 1, mid + 1, nr);
  up(id);
}
void upd(int id, int nl, int nr, int l, int r, long long val) {
  if (r < nl || l > nr) return;
  if (l <= nl && r >= nr) {
    if (!lzy[id]) lzy[id] = val;
    lzy[id] = min(lzy[id], val);
    mn[id] = min(mn[id], val);
    return;
  }
  down(id, nl, nr);
  int mid = nl + nr >> 1;
  upd(id << 1, nl, mid, l, r, val);
  upd(id << 1 | 1, mid + 1, nr, l, r, val);
  up(id);
}
long long qry(int id, int nl, int nr, int l, int r) {
  if (l > nr || r < nl) return INF;
  if (l <= nl && r >= nr) return mn[id];
  down(id, nl, nr);
  int mid = nl + nr >> 1;
  return min(qry(id << 1, nl, mid, l, r), qry(id << 1 | 1, mid + 1, nr, l, r));
}
}  // namespace SegTree
int main() {
  scanf("%d%d%s", &n, &m, s + 1);
  using namespace SegTree;
  build(1, 0, n);
  upd(1, 0, n, 0, 0, 0);
  for (int i = (1); i < (n + 1); i++) {
    long long t;
    if (s[i] == '0') {
      t = qry(1, 0, n, i - 1, i - 1);
      upd(1, 0, n, i, i, t + i);
    } else {
      t = qry(1, 0, n, max(0, i - m - 1), i - 1);
      upd(1, 0, n, i, i + m, t + i);
    }
  }
  printf("%lld\n", qry(1, 0, n, n, n));
  return 0;
}
