#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;
/*

class partially_persistent_disjoint_set;

partially_persistent_disjoint_setは素集合を管理する部分永続なデータ構造です

メンバ関数
-(constructor)(uint32 size)
sizeだけ要素数を持つ素集合を構築します
時間計算量O(n)

-find(uint32 ver, uint32 x)


*/


uint32 top[32] = { 0,0,32,32,63,63,63,63,92,92,92,92,92,92
,92,92,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117 };
uint32 d[32] = { 0,1,1,2,1,2,3,4,1,2,3
,4,5,6,7,8,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
template<typename Semilattice>
class sparse_table {
	using uint32 = std::uint_fast32_t;
	struct block {
		//static constexpr uint32 top[33] = { 0,0,0,32,32,63,63,63,63,92,92,92,92,92,92
		//	,92,92,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117,117 };
		//static constexpr uint32 d[33] = { 0,0,1,1,2,1,2,3,4,1,2,3
		//	,4,5,6,7,8,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
		Semilattice table[134];
		block(const Semilattice *const a) {
			for (uint32 i = 0;i < 32;++i) table[i] = a[i];
			for (uint32 i = 1;i < 5;++i) {
				const uint32 p = (uint32)1 << (i - 1);
				for (uint32 j = 0;j < 33 - (p << 1);++j) {
					table[top[p << 1] + j] = table[top[p] + j] + table[top[p] + j + p];
				}
			}
		}
		Semilattice operator()(const uint32 begin, const uint32 end)const {
			const uint32 p = top[end - begin] + begin;
			return  table[p] + table[p + d[end - begin]];
		}
	};
	std::vector<block> blocks;
	std::vector<std::vector<Semilattice>> table;
public:
	sparse_table(const std::vector<Semilattice> &array) {
		const uint32 s = (array.size() >> 5) + 1;
		blocks.reserve(s);
		for (uint32 i = 0;i < s - 1;++i) {
			blocks.emplace_back(&array[i << 5]);
		}
		Semilattice t[32];
		for (uint32 i = 0;i < 32;++i) {
			t[i] = (i < (array.size() & 0x1f)) ? array[(s - 1) << 5 | i] : Semilattice();
		}
		blocks.emplace_back(t);
		table = std::vector<std::vector<Semilattice>>(32 - __builtin_clz(s));
		table[0].reserve(s);
		for (uint32 i = 0;i < s;++i) {
			table[0].push_back(blocks[i](0, 31));
		}
		for (uint32 i = 1;i < (32 - __builtin_clz(s));++i) {
			table[i].reserve(s - ((uint32)1 << i) + 1);
			for (uint32 j = 0;j <= s - ((uint32)1 << i);++j) {
				table[i].push_back(table[i - 1][j] + table[i - 1][j + ((uint32)1 << (i - 1))]);
			}
		}
	}
	Semilattice operator()(const uint32 begin, const uint32 end)const {
		const uint32 L = (begin >> 5) + 1;
		const uint32 R = (end - 1) >> 5;
		if (L < R) {
			const uint32 p = 31 ^ __builtin_clz(R - L);
			return blocks[L - 1](begin & 31, 31) + table[p][L]
				+ table[p][R - ((uint32)1 << p)] + blocks[R](0, (end - 1) & 31);
		}
		if (L == R) {
			return blocks[L - 1](begin & 31, 31) + blocks[R](0, (end - 1) & 31);
		}
		return blocks[R](begin & 31, (end - 1) & 31);
	}
};
template<typename T>
void uscan(T &d) {
	d = 0;unsigned char c = 0;
	while (c < '0' || '9' < c) c = fgetc(stdin);
	while ('0' <= c&&c <= '9') {
		d = (d << 3) + (d << 1) + c - '0';c = fgetc(stdin);
	}
}
template<typename T>
struct MIN {
	T e;
	MIN(T x = std::numeric_limits<T>::max()) :e(x) {}
	MIN operator~() {
		return *this;
	}
	MIN operator+(const MIN &other)const {
		if (e < other.e) return *this;
		return other;
	};
	MIN operator*(const MIN &other)const {
		return other;
	}
};

int main(void) {
	std::ios::sync_with_stdio(false);
	using M = MIN<uint32>;
	uint32 n, l;
	uscan(n);uscan(l);
	std::vector<M> a(n);
	for (uint32 i = 0;i < n;++i)uscan(a[i].e);
	sparse_table<M> T(a);
	printf("%u", T(0, l).e);
	for (uint32 i = 1;i <= n - l;++i) {
		printf(" %u", T(i, i + l).e);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 46884