//#define NDEBUG
#define _CRT_SECURE_NO_WARNINGS
#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 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;
	}
};

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>
void scan(T &d) {
	d = 0;unsigned char c = 0;bool f = 0;
	while (c < '0' || '9' < c) {
		if (c == '-') f = 1;c = fgetc(stdin);
	}
	while ('0' <= c&&c <= '9') {
		d = (d << 3) + (d << 1) + c - '0';c = fgetc(stdin);
	}
	if (f) d = -d;
}
template<>
void scan(double &d) { scanf("%lf", &d); }

#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 {
			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 {
		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);
	}
};

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("%lu", T.range(0, l).e);
	for (uint32 i = 1;i <= n - l;++i) {
		printf(" %ld", T.range(i, i + l).e);
	}
	fputc('\n', stdout);
	return 0;
}



Measured memory_bytes: 46884