#include <bits/stdc++.h>
using namespace std;
const long long int inf = 9e18;
const long double pi = 2 * acos(0.0);
long long int tes, n, k;
string s;
multiset<long long int> st1, st2;
vector<vector<long long int>> dp(2, vector<long long int>(2e5 + 2, inf));
void solve() {
  cin >> n >> k >> s;
  dp[0][n] = 0;
  st2.insert(0);
  ;
  for (int i = n - 1; i > -1; i--) {
    if (s[i] == '0') {
      dp[0][i] = min(dp[0][i], dp[0][i + 1] + i + 1);
      if ((int)((st1).size()) != 0) {
        dp[0][i] = min(dp[0][i], *st1.begin());
      }
    } else {
      if ((int)((st1).size()) != 0) {
        dp[0][i] = min(dp[0][i], *st1.begin());
      }
      dp[0][i] = min(dp[0][i], dp[0][i + 1] + 1 + i);
      dp[1][i] = min(dp[1][i], i + 1 + *st2.begin());
    }
    if (i + k <= n) {
      auto it = st1.find(dp[1][i + k]);
      if (it != st1.end()) st1.erase(it);
    }
    if (i + k + 1 <= n) {
      auto it = st2.find(dp[0][i + k + 1]);
      if (it != st2.end()) st2.erase(it);
      it = st2.find(dp[1][i + k + 1]);
      if (it != st2.end()) st2.erase(it);
    }
    if (s[i] == '1') st1.insert(dp[1][i]), st2.insert(dp[1][i]);
    st2.insert(dp[0][i]);
  }
  cout << min(dp[0][0], dp[1][0]) << "\n";
}
int32_t main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  tes = 1;
  while (tes--) {
    solve();
  }
}
