Number of primes on an interval
Given
n
numbers, you are asked to look at all the contiguous sub-arrays of length k
and find the segment that has the maximum number of primes in it. Input
The first line of the input contains two integers
n
(1 β€ n β€ 50 000) and k
(1 β€ k β€ n).The next line contains
n
integers
(1 β€ β€ ). Output
The program should print the maximum number of primes in a subarray of length
k
. Examples
Input | Output |
6 3
2 5 10 3 6 7 | 2 |
6 3
5 4 2 3 7 1 | 3 |
6 2
5 1 6 1 7 4 | 1 |
Β
Constraints
Time limit: 10 seconds
Memory limit: 512 MB
Output limit: 1 MB