# 백준 15565번 귀여운 라이언

## Solution

import java.io.*;
import java.util.*;

public class Main {
static StringBuilder sb = new StringBuilder();

static int N, K;
static int[] A;

static void input() {
N = scan.nextInt();
K = scan.nextInt();
A = new int[N + 1];
for (int i = 1; i <= N; i++) {
A[i] = scan.nextInt();
}
}

static void pro() {
int right = 0, count = 0, answer = -1;
for (int left = 1; left <= N; left++) {
while (right < N && count < K) {
right++;
if (A[right] == 1) {
count++;
}
}

if (count == K) {
int size = right - left + 1;
} else {
}
}

if (A[left] == 1) {
count--;
}
}

}

public static void main(String[] args) {
input();
pro();
}

StringTokenizer st;

}

public FastReader(String s) throws FileNotFoundException {
}

String next() {
while (st == null || !st.hasMoreElements()) {
try {
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}

int nextInt() {
return Integer.parseInt(next());
}

long nextLong() {
return Long.parseLong(next());
}

double nextDouble() {
return Double.parseDouble(next());
}

String nextLine() {
String str = "";
try {
}