Max Consecutive Ones III
Given a binary array and an integer K, find the longest subarray of 1s after flipping at most K zeros.
Input format
The first line contains N and K. The second line contains N zeros and ones.
Output format
Print the longest subarray of 1s after flipping at most K zeros to 1s.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
5 2
1 0 1 1 0Expected output
5Example 2
Input
5 1
0 0 1 1 0Expected output
3