LearnPy Hub
← Arena
IntermediateRating 1300

First Negative in Each Window

For every window of k consecutive numbers, print its first negative number, or 0 if it has none.

Input

n and k, then n integers.

Output

n − k + 1 integers.

Sample 1

Input
5 2
-8 2 3 -6 10
Output
-8 0 -6 -6

Sample 2

Input
3 3
1 2 3
Output
0
solution.py
Output appears here
First Negative in Each Window · Python Arena problem · LearnPy Hub