#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 11;
const long long INF = (long long)1e18;
struct tree {
  vector<long long> a, lazy;
  tree() {
    a.assign(N * 4, INF);
    lazy.assign(N * 4, INF);
  }
  void down(int id) {
    for (int i = id * 2; i <= id * 2 + 1; ++i) {
      a[i] = min(a[i], lazy[id]);
      lazy[i] = min(lazy[i], lazy[id]);
    }
  }
  void upd(int id, int l, int r, int u, int v, long long val) {
    if (l > v || r < u) return;
    if (u <= l && r <= v) {
      a[id] = min(a[id], val);
      lazy[id] = min(lazy[id], val);
      return;
    }
    down(id);
    int mid = (l + r) / 2;
    upd(id * 2, l, mid, u, v, val);
    upd(id * 2 + 1, mid + 1, r, u, v, val);
    a[id] = min(a[id * 2], a[id * 2 + 1]);
  }
  long long get(int id, int l, int r, int k) {
    if (l == r) return a[id];
    down(id);
    int mid = (l + r) / 2;
    if (k <= mid) return get(id * 2, l, mid, k);
    return get(id * 2 + 1, mid + 1, r, k);
  }
} it;
int n, k;
char t[N];
long long dp[N];
void solve() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> t[i];
  for (int i = 1; i <= n; ++i) {
    dp[i] = dp[i - 1] + i;
    dp[i] = min(dp[i], it.get(1, 1, n, i));
    if (t[i] == '1') {
      long long tmp = (i > k + 1 ? it.get(1, 1, n, i - k - 1) : 0) + i;
      it.upd(1, 1, n, i - k, i + k, tmp);
    }
    it.upd(1, 1, n, i, i, dp[i]);
  }
  cout << it.get(1, 1, n, n);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
