#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9 + 7;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long pct(long long x) { return __builtin_popcount(x); }
long long bit(long long x) { return 31 - __builtin_clz(x); }
long long cdiv(long long a, long long b) {
  return a / b + !(a < 0 || a % b == 0);
}
void DBG() { cerr << "]" << endl; }
template <class H, class... T>
void DBG(H h, T... t) {
  cerr << to_string(h);
  if (sizeof...(t)) cerr << ", ";
  DBG(t...);
}
const long long maxn = 1e5 * 3 + 20;
long long n, _, q, k;
long long f[maxn][2];
void solve() {
  cin >> n >> k;
  string s;
  cin >> s;
  s = "?" + s;
  for (signed i = 1; i <= n; i++) {
    f[i][0] = f[i][1] = INF;
  }
  deque<long long> dq;
  for (signed i = 1; i <= n; i++) {
    while ((signed)dq.size() && dq.front() < i - k) dq.pop_front();
    if ((signed)dq.size()) {
      long long mn = dq.front();
      f[i][0] = f[mn][1];
    }
    if (s[i] - '0') {
      long long pre = max((long long)0, i - k - 1);
      f[i][1] = min(f[i][1], i + f[pre][0]);
      f[i][1] = min(f[i][1], i + f[pre][1]);
      if ((signed)dq.size()) {
        long long mn = dq.front();
        f[i][1] = min(f[i][1], f[mn][1] + i);
      }
      while ((signed)dq.size() && f[dq.back()][1] > f[i][1]) dq.pop_back();
      dq.push_back(i);
    } else {
      f[i][0] = min(f[i][0], f[i - 1][0] + i);
    }
  }
  cout << min(f[n][0], f[n][1]) << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
