#include <bits/stdc++.h>
using namespace std;
long long MOD = 998244353;
long long INF = 1e18 * 2;
int INF2 = 1e9 * 2;
long long arr[200001], dp[200001];
void solve() {
  int n, k;
  cin >> n >> k;
  char a;
  for (int i = 0; (i) < n; ++(i)) {
    cin >> a;
    arr[i] = a - '0';
  }
  multiset<long long> s;
  for (int i = 0; (i) < n; ++(i)) {
    dp[i] = INF;
    s.insert(INF);
  }
  dp[n] = 0;
  s.insert(0);
  for (int i = n - 1; i >= 0; --i) {
    if (arr[i]) {
      long long l = max(0, i - k);
      long long f = *s.begin();
      if (dp[l] > f + i + 1) {
        s.erase(s.find(dp[l]));
        dp[l] = f + i + 1;
        s.insert(dp[l]);
      }
    }
    if (dp[i] > dp[i + 1] + i + 1) {
      s.erase(s.find(dp[i]));
      dp[i] = dp[i + 1] + i + 1;
      s.insert(dp[i]);
    }
    if (i < n - k) {
      s.erase(s.find(dp[i + k + 1]));
    }
  }
  cout << dp[0];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int t;
  t = 1;
  for (int i = 0; (i) < t; ++(i)) {
    solve();
  }
  return 0;
}
