Given a binary array arr of size N and an integer M. Find the maximum number of consecutive 1's produced by flipping at most M 0's.
 
Example 1:
Input:
N = 3
arr[] = {1, 0, 1}
M = 1
Output:
3
Explanation:
Maximum subarray is of size 3
which can be made subarray of all 1 after
flipping one zero to 1.
Example 2:
Input:
N = 11
arr[] = {1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1}
M = 2
Output:
8
Explanation:
Maximum subarray is of size 8
which can be made subarray of all 1 after
flipping two zeros to 1.
 
Your Task:
Complete the function findZeroes() which takes array arr and two integers n, m, as input parameters and returns an integer denoting the answer. 
 
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)
 
Constraints:
1 <= N <= 10^{7}
0 <= M <= N
0 <= arr_{i} <= 1

Difficulty: MEDIUM
Tags: Data structures
Skill types: Data structures
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3





# m is maximum of number zeroes allowed 

# to flip, n is size of array 

def findZeroes(arr, n, m) :

    # code here

Solutions:
def findZeroes(arr, n, m):
	start = 0
	max1 = 0
	c = 0
	for i in range(n):
		if arr[i] == 0:
			c += 1
		while c > m:
			if arr[start] == 0:
				c -= 1
			start += 1
		max1 = max(max1, i - start + 1)
	return max1


def findZeroes(arr, n, m):
	left = right = zerocount = maxvalue = 0
	while right < n:
		if arr[right] == 0:
			zerocount += 1
		while zerocount > m:
			if arr[left] == 0:
				zerocount -= 1
			left += 1
		maxvalue = max(maxvalue, right - left + 1)
		right += 1
	return maxvalue


import sys

def findZeroes(arr, n, m):
	M = m
	cz = 0
	ans = 0
	i = 0
	for j in range(n):
		if arr[j] == 0:
			M -= 1
		while M < 0:
			if arr[i] == 0:
				M += 1
			i += 1
		cz = j - i + 1
		ans = max(ans, cz)
	return ans


def findZeroes(arr, n, m):
	maxOnes = 0
	zeros = 0
	start = 0
	for index in range(n):
		if arr[index] == 0:
			zeros += 1
		while zeros > m:
			if arr[start] == 0:
				zeros -= 1
			start += 1
		maxOnes = max(index - start + 1, maxOnes)
	return maxOnes


def findZeroes(arr, n, m):
	n = len(arr)
	left = right = maxOnes = zerosCount = 0
	while right < n:
		if arr[right] == 0:
			zerosCount += 1
		while zerosCount > m:
			if arr[left] == 0:
				zerosCount -= 1
			left += 1
		maxOnes = max(maxOnes, right - left + 1)
		right += 1
	return maxOnes


def findZeroes(arr, n, m):
	i = j = result = 0
	max_ones = 0
	while j < n:
		if arr[j] == 1:
			max_ones += 1
		if j - i + 1 - max_ones > m:
			if arr[i] == 1:
				max_ones -= 1
			i += 1
		else:
			result = max(result, j - i + 1)
		j += 1
	return result


def findZeroes(arr, n, m):
	left = 0
	zero = 0
	res = 0
	for right in range(n):
		if arr[right] == 0:
			zero += 1
		if zero > m:
			if arr[left] == 0:
				zero -= 1
			left += 1
		if zero <= m:
			res = max(res, right - left + 1)
	return res


def findZeroes(arr, n, m):
	(i, j, zeroes, ones, res) = (0, 0, 0, 0, 0)
	while j < n:
		if arr[j] == 0:
			zeroes += 1
		else:
			ones += 1
		while j - i + 1 - ones > m:
			if arr[i] == 0:
				zeroes -= 1
			else:
				ones -= 1
			i += 1
		res = max(res, j - i + 1)
		j += 1
	return res


def findZeroes(arr, n, m):
	k = m
	cnt = 0
	l = 0
	i = 0
	mx = -1
	while i < n:
		if arr[i] == 1:
			l += 1
		else:
			if cnt >= m:
				break
			l += 1
			cnt += 1
		i += 1
	mx = max(mx, l)
	s = 0
	while i < n:
		if arr[i] == 0:
			cnt += 1
		if cnt > m:
			if arr[s] == 0:
				cnt -= 1
			s += 1
		if cnt <= m:
			mx = max(mx, i - s + 1)
		i += 1
	return mx


def findZeroes(arr, n, m):
	left = 0
	zeroCount = 0
	maxConsecutiveOnes = 0
	for right in range(n):
		if arr[right] == 0:
			zeroCount += 1
		while zeroCount > m:
			if arr[left] == 0:
				zeroCount -= 1
			left += 1
		windowSize = right - left + 1
		maxConsecutiveOnes = max(maxConsecutiveOnes, windowSize)
	return maxConsecutiveOnes


def findZeroes(arr, n, m):
	c = 0
	res = 0
	j = 0
	for i in range(0, n):
		if arr[i] == 0:
			c += 1
		while c > m:
			if arr[j] == 0:
				c -= 1
			j += 1
		res = max(res, i - j + 1)
	return res


def findZeroes(arr, n, m):
	ans = 0
	countZero = 0
	j = -1
	i = 0
	while i < n:
		if arr[i] == 0:
			countZero += 1
		while countZero > m:
			j += 1
			if arr[j] == 0:
				countZero -= 1
		length = i - j
		ans = max(ans, length)
		i += 1
	return ans


def findZeroes(arr, n, m):
	a = 0
	j = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			a += 1
		if a > m:
			if arr[j] == 0:
				a -= 1
			j += 1
	return n - j


def findZeroes(arr, n, m):
	left = 0
	right = 0
	zeroes = 0
	max_ones = 0
	while right < n:
		if arr[right] == 0:
			zeroes += 1
		while zeroes > m:
			if arr[left] == 0:
				zeroes -= 1
			left += 1
		max_ones = max(max_ones, right - left + 1)
		right += 1
	return max_ones


def findZeroes(arr, n, m):
	(i, j, count) = (0, 0, 0)
	ans = 0
	while j < n:
		if arr[j] == 0:
			count += 1
		while count > m:
			if arr[i] == 0:
				count -= 1
			i += 1
		ans = max(ans, j - i + 1)
		j += 1
	return ans


def findZeroes(s, n, k):
	(i, j) = (0, 0)
	c = 0
	ans = 0
	while j < n:
		if s[j] != 1:
			c += 1
		if c <= k:
			ans = max(ans, j - i + 1)
		else:
			while c > k:
				if s[i] == 0:
					c -= 1
				i += 1
		j += 1
	return ans


def findZeroes(arr, n, m):
	(i, j) = (0, 0)
	ans = 0
	cnt = 0
	while j < len(arr):
		if arr[j] == 0:
			cnt += 1
		if cnt <= m:
			ans = max(ans, j - i + 1)
			j += 1
		else:
			while cnt > m:
				if arr[i] == 0:
					cnt -= 1
				i += 1
			j += 1
	return ans


def findZeroes(arr, n, m):
	(i, j) = (0, 0)
	(ans, res) = (0, 0)
	while j < n:
		if arr[j] == 0:
			ans += 1
		if ans <= m:
			res = max(res, j - i + 1)
			j += 1
		else:
			while ans > m:
				if arr[i] == 0:
					ans -= 1
				i += 1
			j += 1
	return res


def findZeroes(arr, n, m):
	s = 0
	ans = 0
	c = 0
	for i in range(n):
		if arr[i] == 0:
			c += 1
		while c > m:
			if arr[s] == 0:
				c -= 1
			s += 1
		ans = max(ans, i - s + 1)
	return ans


def findZeroes(arr, n, m):
	left = 0
	zeros = 0
	max_cons_ones = 0
	for right in range(n):
		if arr[right] == 0:
			zeros += 1
		while zeros > m:
			if arr[left] == 0:
				zeros -= 1
			left += 1
		max_cons_ones = max(max_cons_ones, right - left + 1)
	return max_cons_ones


def findZeroes(arr, n, m):
	(left, right) = (0, 0)
	count = 0
	maxlen = 0
	while right < n:
		if arr[right] == 0:
			count += 1
		if count > m:
			maxlen = max(maxlen, right - left)
			if arr[left] == 0:
				count -= 1
			left += 1
		right += 1
	maxlen = max(maxlen, right - left)
	return maxlen


def findZeroes(arr, n, m):
	stack = [i for i in range(n - 1, -1, -1) if arr[i] == 0]
	t = m
	maxi = 0
	i = 0
	j = 0
	c = 0
	while i < n:
		if arr[i] == 1:
			c += 1
			i += 1
		elif arr[i] == 0 and t > 0:
			t -= 1
			c += 1
			i += 1
		else:
			old = j
			top = stack.pop()
			j = top + 1
			c -= j - old
			t += 1
		maxi = max(maxi, c)
	return maxi


def findZeroes(arr, n, m):
	nums = arr
	maxm = 0
	(i, j) = (0, 0)
	n = len(nums)
	while j < n:
		if arr[j] == 1:
			maxm = max(maxm, j - i + 1)
			j += 1
		elif arr[j] == 0 and m > 0:
			maxm = max(maxm, j - i + 1)
			j += 1
			m -= 1
		else:
			if arr[i] == 0:
				m += 1
			i += 1
	return maxm


def findZeroes(arr, n, m):
	left = 0
	right = 0
	z = 0
	mx = 0
	while right < n:
		if arr[right] == 0:
			z += 1
		while z > m:
			if arr[left] == 0:
				z -= 1
			left += 1
		right += 1
		mx = max(mx, right - left)
	return mx


def findZeroes(arr, n, m):
	left = right = zeros_count = max_ones_count = 0
	while right < n:
		if arr[right] == 0:
			zeros_count += 1
		while zeros_count > m:
			if arr[left] == 0:
				zeros_count -= 1
			left += 1
		max_ones_count = max(max_ones_count, right - left + 1)
		right += 1
	return max_ones_count


def findZeroes(arr, n, m):
	j = 0
	count = 0
	maxCount = 0
	for i in range(n):
		if arr[i] == 1:
			count = count + 1
		elif m > 0:
			count = count + 1
			m = m - 1
		else:
			while arr[j] != 0 and j < n:
				j = j + 1
			j = j + 1
			count = i - j + 1
		if count > maxCount:
			maxCount = count
	return maxCount


def findZeroes(arr, n, m):
	count = 0
	temp = 0
	maxi = 0
	for i in range(n):
		if arr[i] == 0:
			count += 1
		while count > m:
			if arr[temp] == 0:
				count -= 1
			temp += 1
		maxi = max(maxi, i - temp + 1)
	return maxi


def findZeroes(arr, n, m):
	start = 1
	end = 1
	zero = 0
	maxx = 0
	for i in range(n):
		if arr[i] == 0:
			zero += 1
		end += 1
		while zero > m:
			if arr[start - 1] == 0:
				zero -= 1
			start += 1
		l = end - start
		if l > maxx:
			maxx = l
	return maxx


def findZeroes(arr, n, m):
	start = 0
	c = 0
	for i in range(n):
		if arr[i] == 0:
			c += 1
		if c > m:
			if arr[start] == 0:
				c -= 1
			start += 1
	return n - start


def findZeroes(arr, n, m):
	lW = 0
	rW = 0
	zeroCount = 0
	maxOnes = 0
	while rW < n:
		if zeroCount <= m:
			if arr[rW] == 0:
				zeroCount += 1
			rW += 1
		if zeroCount > m:
			if arr[lW] == 0:
				zeroCount -= 1
			lW += 1
		if rW - lW > maxOnes and zeroCount <= m:
			maxOnes = rW - lW
	return maxOnes


def findZeroes(arr, n, m):
	czero = 0
	j = -1
	ans = 0
	for i in range(n):
		if arr[i] == 0:
			czero += 1
		while czero > m:
			j += 1
			if arr[j] == 0:
				czero -= 1
		tot = i - j
		ans = max(ans, tot)
	return ans


def findZeroes(arr, n, m):
	windowLeft = 0
	windowRight = 0
	result = 0
	zero_count = 0
	while windowRight < n:
		if arr[windowRight] == 0:
			if zero_count == m:
				while arr[windowLeft] != 0:
					windowLeft += 1
				windowLeft += 1
			else:
				zero_count += 1
		windowRight += 1
		result = max(result, windowRight - windowLeft)
	return result


def findZeroes(arr, n, m):
	left = right = s_idx = 0
	maxlen = -1000000000
	while right < len(arr):
		while right < len(arr) and (arr[right] == 1 or m > 0):
			if arr[right] == 0:
				m -= 1
			right += 1
		length = right - left
		if length > maxlen:
			maxlen = length
			s_idx = left
		while left < len(arr) and arr[left] == 1:
			left += 1
		left += 1
		m += 1
	return maxlen


def findZeroes(arr, n, m):
	flip = 0
	count = 0
	ans = 0
	j = 0
	for i in range(n):
		if arr[i] == 0:
			flip = flip + 1
		while flip > m:
			if arr[j] == 0:
				flip = flip - 1
			j = j + 1
		if i - j + 1 > ans:
			ans = i - j + 1
		i = i + 1
	return ans


def findZeroes(arr, n, m):
	i = 0
	j = 0
	cnt = 0
	maxlen = 0
	while j < n:
		if cnt <= m:
			if arr[j] == 0:
				cnt += 1
			maxlen = max(maxlen, j - i)
			j += 1
		else:
			if arr[i] == 0:
				cnt -= 1
			i += 1
	if cnt <= m:
		maxlen = max(maxlen, j - i)
	return maxlen


def findZeroes(arr, n, m):
	wL = wR = 0
	bestWindow = 0
	zeroCount = 0
	while wR < n:
		if zeroCount <= m:
			if arr[wR] == 0:
				zeroCount += 1
			wR += 1
		if zeroCount > m:
			if arr[wL] == 0:
				zeroCount -= 1
			wL += 1
		if wR - wL > bestWindow and zeroCount <= m:
			bestWindow = wR - wL
	return bestWindow


def findZeroes(arr, n, m):
	left = right = 0
	size = zerocount = 0
	while right < n:
		if zerocount <= m:
			if arr[right] == 0:
				zerocount += 1
			right += 1
		if zerocount > m:
			if arr[left] == 0:
				zerocount -= 1
			left += 1
		if right - left > size and zerocount <= m:
			size = right - left
	return size


def findZeroes(arr, n, m):
	left = 0
	zero_count = 0
	max_len = 0
	for right in range(n):
		if arr[right] == 0:
			zero_count += 1
		while zero_count > m:
			if arr[left] == 0:
				zero_count -= 1
			left += 1
		max_len = max(max_len, right - left + 1)
	return max_len


def findZeroes(arr, n, m):
	ans = 0
	zerocount = 0
	j = -1
	for i in range(len(arr)):
		if arr[i] == 0:
			zerocount += 1
		while zerocount > m:
			j += 1
			if arr[j] == 0:
				zerocount -= 1
		ans = max(ans, i - j)
	return ans


def findZeroes(arr, n, m):
	left_index = 0
	right_index = 0
	zeros_count = []
	res = 0
	for i in range(n):
		if arr[i] == 0:
			zeros_count.append(i)
			if len(zeros_count) <= m:
				res = max(res, right_index - left_index)
			else:
				left_index = zeros_count[0] + 1
				zeros_count.pop(0)
				res = max(res, right_index - left_index)
		else:
			res = max(res, right_index - left_index)
		right_index += 1
	return res + 1


def findZeroes(arr, n, m):
	l = 0
	z = 0
	ans = 0
	for i in range(n):
		if arr[i] == 0:
			if z < m:
				z += 1
			else:
				while arr[l] == 1:
					l += 1
				l += 1
		ans = max(ans, i - l + 1)
	return ans


def findZeroes(arr, n, m):
	zero = 0
	length = 0
	j = 0
	for i in range(n):
		if arr[i] == 0:
			zero += 1
		while zero > m:
			if arr[j] == 0:
				zero -= 1
			j += 1
		length = max(length, i - j + 1)
	return length


def findZeroes(arr, n, m):
	zero_cnt = 0
	max_one = 0
	left = 0
	for i in range(n):
		if arr[i] == 0:
			zero_cnt += 1
		if zero_cnt > m:
			if arr[left] == 0:
				zero_cnt -= 1
			left += 1
		max_one = max(max_one, i - left + 1)
	return max_one


def findZeroes(arr, n, m):
	zero_cnt = 0
	max_one = 0
	left = 0
	i = 0
	while i < n:
		if arr[i] == 0:
			zero_cnt += 1
		while zero_cnt > m:
			if arr[left] == 0:
				zero_cnt -= 1
			left += 1
		max_one = max(max_one, i - left + 1)
		i += 1
	return max_one


def findZeroes(arr, n, k):
	i = 0
	j = 0
	max_count = 0
	zeroes_count = 0
	while j < len(arr):
		if arr[j] == 0:
			zeroes_count += 1
		if zeroes_count > k:
			max_count = max(max_count, j - i)
			while zeroes_count > k:
				if arr[i] == 0:
					zeroes_count -= 1
				i += 1
		j += 1
	max_count = max(max_count, j - i)
	return max_count


def findZeroes(arr, n, m):
	count = 0
	l = 0
	r = 0
	length = 0
	while l <= r and r < n:
		if arr[r] == 0:
			count += 1
		while count > m and l < r:
			if arr[l] == 0:
				count -= 1
			l += 1
		length = max(length, r - l + 1)
		r += 1
	return length


def findZeroes(arr, n, m):
	result = 0
	count = 0
	left = 0
	for right in range(n):
		if arr[right] == 0:
			count += 1
		while count > m:
			if arr[left] == 0:
				count -= 1
			left += 1
		result = max(result, right - left + 1)
	return result


def findZeroes(arr, n, m):
	p1 = 0
	p2 = 0
	maxi = 0
	while p2 < n and p1 < n:
		if m > 0 or arr[p2] == 1:
			if arr[p2] == 0:
				m -= 1
			maxi = max(maxi, p2 - p1 + 1)
			p2 += 1
		else:
			if arr[p1] == 0:
				m += 1
			p1 += 1
	return maxi


def findZeroes(arr, n, m):
	right = 0
	left = 0
	countZero = 0
	while right < n:
		if arr[right] == 0:
			countZero += 1
		if countZero > m:
			if arr[left] == 0:
				countZero -= 1
			left += 1
		right += 1
	return right - left


def findZeroes(arr, n, m):
	zc = 0
	start = 0
	mcs = 0
	for i in range(0, n):
		if arr[i] == 0:
			zc += 1
		while zc > m:
			if arr[start] == 0:
				zc -= 1
			start = start + 1
		mcs = max(mcs, i - start + 1)
	return mcs


def findZeroes(arr, n, m):
	window_size = 0
	j = 0
	for i in range(n):
		if arr[i] == 0:
			if m > 0:
				m -= 1
			else:
				while arr[j] != 0:
					j += 1
				j += 1
		window_size = max(i - j + 1, window_size)
	return window_size


def findZeroes(arr, n, m):
	i = 0
	j = 0
	maxi = 0
	countZeros = 0
	while j < n:
		if arr[j] == 0:
			countZeros += 1
		while countZeros > m:
			if arr[i] == 0:
				countZeros -= 1
			i += 1
		maxi = max(maxi, j - i + 1)
		j += 1
	return maxi


def findZeroes(arr, n, m):
	i = 0
	out = float('-inf')
	count = 0
	for k in range(n):
		if arr[k] == 0:
			count += 1
		while count > m:
			if arr[i] == 0:
				count -= 1
				i += 1
				break
			i += 1
		out = max(out, k - i + 1)
	return out


def findZeroes(arr, n, m):
	left = right = zero_count = max_count = 0
	while right < n:
		if arr[right] == 0:
			zero_count += 1
		right += 1
		while zero_count > m:
			if arr[left] == 0:
				zero_count -= 1
			left += 1
		max_count = max(max_count, right - left)
	return max_count


def findZeroes(a, n, m):
	mx = m
	left = m
	j = 0
	for i in range(n):
		if a[i] == 0:
			if left:
				left -= 1
			else:
				while j < i and a[j] == 1:
					j += 1
				j += 1
		mx = max(mx, i - j + 1)
	return mx


def findZeroes(arr, n, m):
	(l, r, z) = (0, 0, 0)
	res = 0
	while r < n:
		if arr[r] == 0:
			z += 1
		while z > m:
			if arr[l] == 0:
				z -= 1
			l += 1
		res = max(res, r - l + 1)
		r += 1
	return res


def findZeroes(nums, n, k):
	i = 0
	j = 0
	maxi = 0
	count = 0
	while j < len(nums):
		if nums[j] == 0:
			count += 1
		if count < k:
			maxi = max(maxi, j - i + 1)
			j += 1
		elif count == k:
			maxi = max(maxi, j - i + 1)
			j += 1
		elif count > k:
			while count > k:
				if nums[i] == 0:
					count -= 1
				i += 1
			maxi = max(maxi, j - i + 1)
			j += 1
	return maxi


def findZeroes(arr, n, m):
	i = 0
	j = 0
	c = 0
	s = 0
	mx = 0
	while j < n:
		if arr[j] == 0:
			c += 1
		if c > m:
			if arr[i] == 0:
				c -= 1
			i += 1
		if c <= m:
			mx = max(mx, j - i + 1)
		j += 1
	return mx


def findZeroes(arr, n, m):
	left = right = 0
	best_win = 0
	zero_count = 0
	while right < n:
		if zero_count <= m:
			if arr[right] == 0:
				zero_count += 1
			right += 1
		if zero_count > m:
			if arr[left] == 0:
				zero_count -= 1
			left += 1
		if right - left > best_win:
			best_win = right - left
	return best_win


def findZeroes(nums, n, m):
	if not nums:
		return 0
	res = 0
	left = 0
	count = 0
	for i in range(len(nums)):
		cur = nums[i]
		if cur == 0:
			count += 1
		while count > m:
			if nums[left] == 0:
				count -= 1
			left += 1
		res = max(res, i - left + 1)
	return res


def findZeroes(arr, n, m):
	if m == 0:
		maxi = 0
		count = 0
		for i in range(n):
			if arr[i] == 1:
				count += 1
				if i == n - 1:
					maxi = max(maxi, count)
					return maxi
			else:
				maxi = max(maxi, count)
				count = 0
		return maxi
	start = 0
	cnt_0 = 0
	for i in range(n):
		if arr[i] == 0:
			cnt_0 += 1
		if cnt_0 > m:
			if arr[start] == 0:
				cnt_0 -= 1
			start += 1
	return n - start


def findZeroes(arr, n, m):
	maxi = 0
	cnt = 0
	i = 0
	for j in range(n):
		if arr[j] == 0:
			cnt += 1
		while cnt > m:
			if arr[i] == 0:
				cnt -= 1
			i += 1
		maxi = max(maxi, j - i + 1)
	return maxi


def findZeroes(a, n, m):
	c = 0
	ans = 0
	i = 0
	j = 0
	while i < n:
		if a[i] == 0:
			c += 1
			if c > m:
				while c > m:
					if a[j] == 0:
						c -= 1
					j += 1
		if c <= m:
			ans = max(ans, i - j + 1)
		i += 1
	return ans


def findZeroes(arr, n, m):
	z = 0
	l = 0
	mac = 0
	for i in range(n):
		if arr[i] == 0:
			z += 1
		if z > m:
			if arr[l] == 0:
				z = z - 1
			l += 1
		mac = max(mac, i - l + 1)
	return mac


def findZeroes(arr, n, m):
	end = start = count = 0
	while end < n:
		if arr[end] == 0:
			count += 1
		if count > m:
			if arr[start] == 0:
				count -= 1
			start += 1
		end += 1
	return end - start


def findZeroes(arr, n, m):
	left = right = maxOnesCount = zerosCount = 0
	while right < n:
		if arr[right] == 0:
			zerosCount += 1
		while zerosCount > m:
			if arr[left] == 0:
				zerosCount -= 1
			left += 1
		maxOnesCount = max(maxOnesCount, right - left + 1)
		right += 1
	return maxOnesCount


def findZeroes(arr, n, m):
	left = right = res = zero_counter = 0
	while right < n:
		if arr[right] == 0:
			zero_counter += 1
		while zero_counter > m:
			if arr[left] == 0:
				zero_counter -= 1
			left += 1
		res = max(res, right - left + 1)
		right += 1
	return res


def findZeroes(arr, n, m):
	left = 0
	right = 0
	max_len = 0
	zero_count = 0
	while right < len(arr):
		if arr[right] == 0:
			zero_count += 1
		while zero_count > m:
			if arr[left] == 0:
				zero_count -= 1
			left += 1
		max_len = max(max_len, right - left + 1)
		right += 1
	return max_len


def findZeroes(arr, N, M):
	cnt = 0
	start = 0
	i = 0
	maxi = -1
	while i < N:
		if arr[i] == 0:
			cnt += 1
		while cnt > M and start < i:
			if arr[start] == 0:
				cnt -= 1
			start += 1
		maxi = max(maxi, i - start + 1)
		i += 1
	return maxi


import sys

def findZeroes(arr, n, m):
	i = 0
	j = 0
	maxi = -sys.maxsize
	numzeroes = 0
	while j < n:
		if arr[j] == 0:
			numzeroes += 1
			while numzeroes > m:
				if arr[i] == 0:
					numzeroes -= 1
				i += 1
		maxi = max(maxi, j - i + 1)
		j += 1
	return maxi