#https://www.acmicpc.net/problem/11003
#백준 11003번 최솟값 찾기(자료구조)
#import sys
#input = sys.stdin.readline
from collections import deque

n, l = map(int, input().split())
nums = list(map(int, input().split()))

q = deque()
result = []

for i in range(n):
    num = nums[i]
    while q and q[-1] > num:
        q.pop()
    q.append(num)
    if i >= l and q[0] == nums[i-l]:
        q.popleft()
    print(q[0], end = ' ')
            
0884708b03df7e7416586edac680b50d58494fb7
<mask token>

<mask token>
for i in range(n):
    num = nums[i]
    while q and q[-1] > num:
        q.pop()
    q.append(num)
    if i >= l and q[0] == nums[i - l]:
        q.popleft()
    print(q[0], end=' ')

<mask token>
n, l = map(int, input().split())
nums = list(map(int, input().split()))
q = deque()
result = []
for i in range(n):
    num = nums[i]
    while q and q[-1] > num:
        q.pop()
    q.append(num)
    if i >= l and q[0] == nums[i - l]:
        q.popleft()
    print(q[0], end=' ')

from collections import deque
n, l = map(int, input().split())
nums = list(map(int, input().split()))
q = deque()
result = []
for i in range(n):
    num = nums[i]
    while q and q[-1] > num:
        q.pop()
    q.append(num)
    if i >= l and q[0] == nums[i - l]:
        q.popleft()
    print(q[0], end=' ')

#https://www.acmicpc.net/problem/11003
#백준 11003번 최솟값 찾기(자료구조)
#import sys
#input = sys.stdin.readline
from collections import deque

n, l = map(int, input().split())
nums = list(map(int, input().split()))

q = deque()
result = []

for i in range(n):
    num = nums[i]
    while q and q[-1] > num:
        q.pop()
    q.append(num)
    if i >= l and q[0] == nums[i-l]:
        q.popleft()
    print(q[0], end = ' ')
            