//#define NDEBUG
#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#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;
using intl32 = std::int_least32_t;
using intl64 = std::int_least64_t;
using uintl32 = std::uint_least32_t;
using uintl64 = std::uint_least64_t;
/*

template<typename Semilattice>
class sparse_table;

sparse_tableは代数的構造の区間和を計算する静的なデータ構造です


templateパラメータ
-Semilattice
結合律　(a * b) * c = a * (b * c)
交換律　a * b = b * a
冪等律　a * a = a
以上の性質を満たす構造体
operator+で演算が定義されている必要があります
演算の対象にできる適当な値で初期化するデフォルトコンストラクタが必要です


メンバ関数
-(constructor)(std::vector<Semilattice> array)
arrayの要素からsparse_tableを構築します
時間計算量:O(NloglogN)

-range(uint32 begin, uint32 end)
半開区間[begin,end)の区間和を返します
時間計算量:O(1)


※N:arrayの要素数
※__builtin_clzの時間計算量をO(1)と仮定
※Semilattice::operator+の計算量をO(1)と仮定

*/


#ifndef __GNUC__
uint32 __builtin_clz(uint32 c) {
	uint32 t = 31;
	if (c & 0xFFFF0000) { c &= 0xFFFF0000;t ^= 16; }
	if (c & 0xFF00FF00) { c &= 0xFF00FF00;t ^= 8; }
	if (c & 0xF0F0F0F0) { c &= 0xF0F0F0F0;t ^= 4; }
	if (c & 0xCCCCCCCC) { c &= 0xCCCCCCCC;t ^= 2; }
	if (c & 0xAAAAAAAA) { c &= 0xAAAAAAAA;t ^= 1; }
	return t;
}
#endif
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 range(const uint32 begin, const uint32 end) {
			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].range(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 range(const uint32 begin, const uint32 end) {
		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].range(begin & 31, 31) + table[p][L]
				+ table[p][R - ((uint32)1 << p)] + blocks[R].range(0, (end - 1) & 31);
		}
		if (L == R) {
			return blocks[L - 1].range(begin & 31, 31) + blocks[R].range(0, (end - 1) & 31);
		}
		return blocks[R].range(begin & 31, (end - 1) & 31);
	}
};

struct MIN {
	int64 e;
	MIN(int64 x = std::numeric_limits<int64>::max()) :e(x) {}
	MIN operator~() {
		return *this;
	}
	MIN operator+(const MIN &other) {
		if (e < other.e) return *this;
		return other;
	};
	MIN operator*(const MIN &other) {
		return other;
	}
};

template<typename T>
void scan(T &d) {
	static 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>
void print(T d) {
	static unsigned char f[20] = {};
	uint32 s = 0;
	while (d) {
		f[++s] = d % 10;
		d /= 10;
	}
	++s;
	while (--s) {
		fputc(f[s] + '0', stdout);
	}
}

int main(void) {
	std::ios::sync_with_stdio(false);
	unsigned char c = 0;
	int64 v = 0;
	uint32 n = 0, l = 0;
	scan(n);
	scan(l);
	std::vector<MIN> a(n, 0);
	for (uint32 i = 0;i < n;++i) {
		scan(a[i].e);
	}
	sparse_table<MIN> T(a);
	print(T.range(0, l).e);
	for (uint32 i = 1;i <= n - l;++i) {
		fputc(' ', stdout);
		print(T.range(i, i + l).e);
	}
	fputc('\n', stdout);
	return 0;
}



Measured memory_bytes: 46884