#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
int a[maxn];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++)
    if (a[i] != 1) a[i] = 0;
  int cnt = 0, ans = 0;
  while (cnt < n) {
    if (a[cnt] == 0) {
      ans++;
      cnt += k;
    }
  }
  cnt = n - 1;
  int tmp = 0;
  while (cnt >= 0) {
    if (a[cnt] == 0) {
      tmp++;
      cnt -= k;
    }
  }
  cout << min(ans, tmp) << endl;
  return 0;
}
