#include <bits/stdc++.h>
using namespace std;
class scanner {
 public:
  scanner &operator>>(bool &var) {
    scanf("%d", &var);
    return *this;
  }
  scanner &operator>>(int &var) {
    scanf("%d", &var);
    return *this;
  }
  scanner &operator>>(unsigned int &var) {
    scanf("%u", &var);
    return *this;
  }
  scanner &operator>>(long long &var) {
    scanf("%I64d", &var);
    return *this;
  }
  scanner &operator>>(unsigned long long &var) {
    scanf("%I64u", &var);
    return *this;
  }
  scanner &operator>>(double &var) {
    scanf("%lf", &var);
    return *this;
  }
  scanner &operator>>(long double &var) {
    double t;
    scanf("%lf", &t);
    var = t;
    return *this;
  }
  scanner &operator>>(char &var) {
    scanf(" %c", &var);
    return *this;
  }
  scanner &operator>>(char var[]) {
    scanf("%s", var);
    return *this;
  }
  scanner &operator>>(string &var) {
    scanf("%s", T);
    var = T;
    return *this;
  }

 private:
  char T[100005];
} __scan;
class printer {
 public:
  printer &operator<<(bool var) {
    printf("%d", var);
    return *this;
  }
  printer &operator<<(int var) {
    printf("%d", var);
    return *this;
  }
  printer &operator<<(unsigned int var) {
    printf("%u", var);
    return *this;
  }
  printer &operator<<(long long var) {
    printf("%I64d", var);
    return *this;
  }
  printer &operator<<(unsigned long long var) {
    printf("%I64u", var);
    return *this;
  }
  printer &operator<<(double var) {
    printf("%f", var);
    return *this;
  }
  printer &operator<<(long double var) {
    printf("%f", (double)var);
    return *this;
  }
  printer &operator<<(char var) {
    printf("%c", var);
    return *this;
  }
  printer &operator<<(const char var[]) {
    printf("%s", var);
    return *this;
  }
  printer &operator<<(string &var) {
    printf("%s", var.c_str());
    return *this;
  }
} __print;
void scan() {}
template <typename T, typename... REST>
void scan(T &var, REST &...rest) {
  __scan >> var;
  scan(rest...);
}
void print() {}
template <typename T, typename... REST>
void print(T var, REST... rest) {
  __print << var << ' ';
  print(rest...);
}
void print_con() {}
template <typename T, typename... REST>
void print_con(T var, REST... rest) {
  __print << var;
  print_con(rest...);
}
template <typename T>
void print(vector<T> &V) {
  print_con("[");
  if (V.size() > 0) print_con(" ", V[0]);
  for (int i = 1; i < V.size(); i++) print_con(", ", V[i]);
  print_con(" ]\n");
}
template <typename T>
void print(set<T> &S) {
  auto it = S.begin();
  print_con("{");
  if (S.size() > 0) print_con(" ", *it++);
  while (it != S.end()) print_con(", ", *it++);
  print_con(" }\n");
}
template <typename T>
void print(multiset<T> &S) {
  auto it = S.begin();
  print_con("{");
  if (S.size() > 0) print_con(" ", *it++);
  while (it != S.end()) print_con(", ", *it++);
  print_con(" }\n");
}
template <typename T>
void print(queue<T> &Q) {
  queue<T> t = Q;
  print_con("<-");
  if (t.size() > 0) {
    print_con(" ", +t);
    --t;
  }
  while (!t.empty()) {
    print_con(", ", +t);
    --t;
  }
  print_con(" <-\n");
}
template <typename T>
void print(stack<T> &S) {
  stack<T> s = S, t;
  while (!s.empty()) {
    t += +s;
    s--;
  }
  print_con("|");
  if (t.size() > 0) {
    print_con(" ", +t);
    --t;
  }
  while (!t.empty()) {
    print_con(", ", +t);
    --t;
  }
  print_con(" <->\n");
}
template <typename T>
void print(deque<T> &DQ) {
  deque<T> t = DQ;
  print_con("<->");
  if (t.size() > 0) {
    print_con(" ", +t);
    --t;
  }
  while (!t.empty()) {
    print_con(", ", +t);
    --t;
  }
  print_con(" <->\n");
}
template <typename K, typename V>
void print(map<K, V> &M) {
  auto it = M.begin();
  print_con("{");
  if (M.size() > 0) {
    print_con(" ( ", it->first, " : ", it->second, " )");
    it++;
  }
  while (it != M.end()) {
    print_con(", ( ", it->first, " : ", it->second, " )");
    it++;
  }
  print_con(" }\n");
}
template <typename T>
T sum(T var) {
  return var;
}
template <typename T, typename... REST>
T sum(T var, REST... rest) {
  return var + sum(rest...);
}
template <typename T>
T mul(T var) {
  return var;
}
template <typename T, typename... REST>
T mul(T var, REST... rest) {
  return var * mul(rest...);
}
template <typename T>
T max_(T var) {
  return var;
}
template <typename T, typename... REST>
T max_(T var, REST... rest) {
  T max_rest = max_(rest...);
  return (var > max_rest) ? (var) : (max_rest);
}
template <typename T>
T min_(T var) {
  return var;
}
template <typename T, typename... REST>
T min_(T var, REST... rest) {
  T min_rest = min_(rest...);
  return (var < min_rest) ? (var) : (min_rest);
}
string operator*(string S, int t) {
  string T;
  while (t--) T += S;
  return T;
}
template <typename T>
void operator+=(vector<T> &V, T var) {
  V.push_back(var);
}
template <typename T>
void operator<<(vector<T> &V, T var) {
  V.push_back(var);
}
template <typename T>
void operator>>(T var, vector<T> &V) {
  V.push_back(var);
}
template <typename T>
void operator--(vector<T> &V) {
  V.pop_back();
}
template <typename T>
void operator--(vector<T> &V, int) {
  V.pop_back();
}
template <typename T>
void operator+=(vector<T> &V1, vector<T> &V2) {
  V1.insert(V1.end(), V2.begin(), V2.end());
}
template <typename T>
void operator+=(set<T> &S, T var) {
  S.insert(var);
}
template <typename T>
void operator<<(set<T> &S, T var) {
  S.insert(var);
}
template <typename T>
void operator>>(T var, set<T> &S) {
  S.insert(var);
}
template <typename T>
void operator+=(multiset<T> &S, T var) {
  S.insert(var);
}
template <typename T>
void operator<<(multiset<T> &S, T var) {
  S.insert(var);
}
template <typename T>
void operator>>(T var, multiset<T> &S) {
  S.insert(var);
}
template <typename T>
void operator+=(queue<T> &Q, T var) {
  Q.push(var);
}
template <typename T>
void operator<<(queue<T> &Q, T var) {
  Q.push(var);
}
template <typename T>
void operator>>(T var, queue<T> &Q) {
  Q.push(var);
}
template <typename T>
void operator--(queue<T> &Q) {
  Q.pop();
}
template <typename T>
void operator--(queue<T> &Q, int) {
  Q.pop();
}
template <typename T>
T operator+(queue<T> &Q) {
  return Q.front();
}
template <typename T>
T operator-(queue<T> &Q) {
  return Q.front();
}
template <typename T>
void operator+=(stack<T> &S, T var) {
  S.push(var);
}
template <typename T>
void operator<<(stack<T> &S, T var) {
  S.push(var);
}
template <typename T>
void operator>>(T var, stack<T> &S) {
  S.push(var);
}
template <typename T>
void operator--(stack<T> &S) {
  S.pop();
}
template <typename T>
void operator--(stack<T> &S, int) {
  S.pop();
}
template <typename T>
T operator+(stack<T> &S) {
  return S.top();
}
template <typename T>
T operator-(stack<T> &S) {
  return S.top();
}
template <typename T>
void operator+=(deque<T> &DQ, T var) {
  DQ.push_back(var);
}
template <typename T>
void operator<<(deque<T> &DQ, T var) {
  DQ.push_back(var);
}
template <typename T>
void operator>>(T var, deque<T> &DQ) {
  DQ.push_front(var);
}
template <typename T>
void operator--(deque<T> &DQ) {
  DQ.pop_front();
}
template <typename T>
void operator--(deque<T> &DQ, int) {
  DQ.pop_back();
}
template <typename T>
T operator+(deque<T> &DQ) {
  return DQ.front();
}
template <typename T>
T operator-(deque<T> &DQ) {
  return DQ.back();
}
unsigned long long pow2(int n) { return 1llu << n; }
unsigned long long pow10(int n) {
  unsigned long long T = 1;
  for (int i = 1; i <= n; i++) T *= 10;
  return T;
}
unsigned long long pow(int b, int n) {
  unsigned long long T = 1;
  for (int i = 1; i <= n; i++) T *= b;
  return T;
}
unsigned long long fact(int n) {
  unsigned long long T = 1;
  for (int i = 2; i <= n; i++) T *= i;
  return T;
}
unsigned long long P(int n, int r) {
  unsigned long long T = 1;
  for (int i = n - r + 1; i <= n; i++) T *= i;
  return T;
}
unsigned long long C(int n, int r) {
  unsigned long long T = P(n, r);
  for (int i = 2; i <= r; i++) T /= i;
  return T;
}
int digit(unsigned long long n, int d) { return (n / pow10(d)) % 10; }
bool eq(double a, double b) { return fabs(a - b) <= 0.00000001; }
template <typename T>
vector<T> gen_prime(T n) {
  bool t[n + 1];
  vector<T> V;
  for (int i = 2; i <= n; i++) {
    if (!t[i]) {
      V.push_back(i);
      for (int j = 2 * i; j <= n; j += i) t[j] = 1;
    }
  }
  return V;
}
template <typename T>
vector<T> factor(T n) {
  vector<T> V;
  for (int i = 2; i * i <= n; i++)
    while (n % i == 0) {
      V.push_back(i);
      n /= i;
    }
  if (n > 1) V.push_back(n);
  return V;
}
vector<bool> bits(unsigned long long m, int n) {
  vector<bool> V;
  for (int i = 1; i <= n; i++) {
    V.push_back(m & 1);
    m >>= 1;
  }
  return V;
}
int n, k, a[100001], p = 1, c = 0, ans = 2000000000ll;
char t;
void solve() {
  scan(n, k);
  for (int i = 1; i <= n; i++) {
    scan(t);
    if (t == '0') {
      a[++c] = i;
    }
  }
  for (int i = 1; i <= c - k; i++) {
    while ((a[p] - a[i]) < (a[i + k] - a[p])) {
      ((ans > a[i + k] - a[p]) ? (ans = a[i + k] - a[p], 1) : 0);
      p++;
    }
    ((ans > a[p] - a[i]) ? (ans = a[p] - a[i], 1) : 0);
  }
  print(ans);
  return;
}
void prep() { return; }
int main() {
  if (0) {
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
  }
  prep();
  if (0) {
    int test_num;
    scanf("%d", &test_num);
    for (int test_count = 1; test_count <= test_num; test_count++) {
      if (0) {
        cerr << "\n>>>>> Test " << test_count << " <<<<<\n";
      }
      if (0) {
        printf("Case #%d: ", test_count);
      }
      solve();
    }
  } else {
    solve();
  }
  return 0;
}
