Pondo Minimum


Problem Statement

Pondo has an array of integers aa of length nn as well as an integer kk. He wishes to form the array bb of length nk+1n - k + 1 by taking taking all the subarrays of length kk and taking their minimums, i.e. bi=min0jk1(ai+j)b_i = \min_{0\leq j \leq k-1}(a_{i+j}).

Input Format

Your first line will contain two space-separated integers nn and kk. Your next line will contain nn integers representing aa.

Output Format

You should output nk+1n - k + 1 integers representing bb.

Constraints

  • 1n1051 \leq n \leq 10^5
  • 1ai1091 \leq a_i \leq 10^9

Sample Cases

Input 1
10 5
10 9 8 7 6 5 4 3 2 1
Output 1
6 5 4 3 2 1
Input 2
10 4
684839257 302743967 551107459 232951579 483565957 241081121 553311714 547334166 25972405 997164454
Output 2
232951579 232951579 232951579 232951579 241081121 25972405 25972405

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.