#define NDEBUG
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <type_traits>
#include <utility>
#include <vector>

std::size_t bsr32(std::uint_fast32_t c) {
#ifdef __GNUC__
	return 31 ^ __builtin_clz(c);
#else
	std::size_t ret = 0;
	if (c & 0xFFFF0000)
		c &= 0xFFFF0000, ret |= 16;
	if (c & 0xFF00FF00)
		c &= 0xFF00FF00, ret |= 8;
	if (c & 0xF0F0F0F0)
		c &= 0xF0F0F0F0, ret |= 4;
	if (c & 0xCCCCCCCC)
		c &= 0xCCCCCCCC, ret |= 2;
	if (c & 0xAAAAAAAA)
		ret |= 1;
	return ret;
#endif
}

template <class Semigroup> class DisjointSparseTable {
public:
	using container_type = std::vector<std::vector<Semigroup>>;
	using value_type = typename container_type::value_type::value_type;
	using const_reference = typename container_type::value_type::const_reference;
	using size_type = typename container_type::value_type::size_type;

protected:
	container_type c;

private:
	template <class TT = value_type,
		std::enable_if_t<std::is_default_constructible<TT>::value,
		std::nullptr_t> = nullptr>
		value_type fold_(size_type first, size_type last) const {
		assert(first <= size());
		assert(last <= size());
		assert(first <= last);
		if (first == last)
			return value_type();
		if (first == --last)
			return c.front()[first];
		const size_type h = bsr32(first ^ last);
		return c[h][first] + c[h][last];
	}
	template <class TT = value_type,
		std::enable_if_t<!std::is_default_constructible<TT>::value,
		std::nullptr_t> = nullptr>
		value_type fold_(size_type first, size_type last) const {
		assert(first < size());
		assert(last <= size());
		assert(first < last);
		if (first == --last)
			return c.front()[first];
		const size_type h = bsr32(first ^ last);
		return c[h][first] + c[h][last];
	}

public:
	DisjointSparseTable() : c() {}
	template <class InputIterator>
	DisjointSparseTable(InputIterator first, InputIterator last) : c() {
		c.emplace_back(first, last);
		const size_type s = c.front().size();
		c.resize(s ? (s == static_cast<size_type>(1) ? 1 : (bsr32(s - 1) + 1)) : 0);
		typename container_type::value_type temp;
		for (size_type i = 1; i < c.size(); ++i) {
			const size_type width = static_cast<size_type>(1) << i;
			for (size_type j = width; j < s; j += width << 1) {
				temp.reserve(width);
				temp.emplace_back(c.front()[j - 1]);
				for (size_type k = 2; k <= width; ++k)
					temp.emplace_back(c.front()[j - k] + temp.back());
				for (size_type k = width - 1; ~k; --k)
					c[i].emplace_back(std::move(temp[k]));
				temp.erase(temp.cbegin(), temp.cend());
				c[i].emplace_back(c.front()[j]);
				for (size_type k = 1; k < width && j + k < s; ++k)
					c[i].emplace_back(c[i].back() + c.front()[j + k]);
			}
		}
	}

	size_type size() const { return c.empty() ? 0 : c.front().size(); }
	bool empty() const { return c.empty(); }

	const_reference operator[](const size_type index) const {
		assert(index < size());
		return c.front()[index];
	}
	value_type fold(const size_type first, const size_type last) const {
		return fold_(first, last);
	}
};

#include<algorithm>
template <class T> struct Mini {
	using value_type = T;
	value_type a;
	Mini() : a(std::numeric_limits<value_type>::max()) {}
	explicit Mini(const value_type &x) : a(x) {}
	explicit Mini(value_type &&x) : a(std::move(x)) {}
	Mini operator+(const Mini &o) const { return Mini(std::min(a, o.a)); }
};
#include<cstdio>
#include<vector>

int main() {
	using uint = unsigned int;
	using M = Mini<uint>;
	uint n, l;
	scanf("%u%u", &n, &l);
	std::vector<uint> a(n);
	for (auto &e : a)
		scanf("%u", &e);
	DisjointSparseTable<M> D(a.cbegin(), a.cend());
	for (int i = 0;i <= n - l;++i)
		printf("%u%c", D.fold(i, i + l), " \n"[i == n - l]);
	return 0;
}


Measured memory_bytes: 90588