#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 50;
long long dp[maxn], n, k;
char s[maxn];
long long q[maxn], m[maxn];
int main() {
  cin >> n >> k;
  cin >> s + 1;
  int l = 0, r = -1;
  for (int i = 0; i <= n + k; ++i) {
    if (i == 0)
      dp[0] = 0;
    else if (i >= 1 && i <= n)
      dp[i] = dp[i - 1] + i;
    else
      dp[i] = dp[i - 1];
    if (i >= k) {
      if (s[i - k] == '1') {
        dp[i] = min(dp[i], m[i - 1] + (i - k));
      }
    }
    while (r >= l && dp[q[r]] >= dp[i]) r--;
    q[++r] = i;
    if (q[r] - q[l] > 2 * k) l++;
    m[i] = dp[q[l]];
  }
  cout << dp[n + k] << endl;
  return 0;
}
