#include <bits/stdc++.h>
using namespace std;
int n, k;
char a[200010];
long long f[200010][2];
deque<int> q;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> a;
  for (int i = 1; i <= n; i++) {
    f[i][0] = min(f[i - 1][0], f[i - 1][1]) + i;
    if (a[i - 1] == '1') {
      int i2 = max(i - k - 1, 0);
      f[i][1] = min(f[i2][0], f[i2][1]) + i;
    } else
      f[i][1] = 1e18;
    while (q.size() > 0 && q.front() < i - k) q.pop_front();
    if (q.size() > 0) {
      f[i][0] = min(f[i][0], f[q.front()][1]);
      if (a[i - 1] == '1') {
        f[i][1] = min(f[i][1], f[q.front()][1] + i);
      }
    }
    while (q.size() > 0 && f[q.back()][1] >= f[i][1]) q.pop_back();
    q.push_back(i);
  }
  cout << min(f[n][0], f[n][1]);
  return 0;
}
