#include <array>
#include <cassert>
#include <cstddef>
#include <memory>
#include <vector>

template <class Semigroup, std::size_t N> class StaticRangeSum {

public:
	using value_type = Semigroup;
	using reference = value_type &;
	using const_reference = const value_type &;
	using size_type = std::size_t;

private:
	static size_type bsr32(size_type x) {
#ifdef __GNUC__
		return 31 ^ __builtin_clz(x);
#else
		size_type ret = 0;
		if (x & 0xFFFF0000)
			x &= 0xFFFF0000, ret |= 16;
		if (x & 0xFF00FF00)
			x &= 0xFF00FF00, ret |= 8;
		if (x & 0xF0F0F0F0)
			x &= 0xF0F0F0F0, ret |= 4;
		if (x & 0xCCCCCCCC)
			x &= 0xCCCCCCCC, ret |= 2;
		if (x & 0xAAAAAAAA)
			ret |= 1;
		return ret;
#endif
	}
	static constexpr size_type getlog(const size_type s) {
		size_type ret = 1;
		while ((static_cast<size_type>(1) << (ret + 1)) <= s)
			++ret;
		return ret;
	}
	static constexpr size_type LOGLOGN = getlog(getlog(N));
	static constexpr size_type LOGN = static_cast<size_type>(1) << LOGLOGN;
	static constexpr size_type LOGB = getlog((N / LOGN + 1)) + 1;
	static constexpr size_type B = static_cast<size_type>(1) << LOGB;
	class Brock {
		std::array<std::array<value_type, LOGN>, LOGLOGN> c;

	public:
		Brock() {}
		template <class Allocator, class InputIterator>
		Brock(Allocator &alc, InputIterator first) {
			using traits = std::allocator_traits<Allocator>;
			for (size_type i = 0; i < LOGN; ++i, ++first)
				traits::construct(alc, std::addressof(c[0][i]), *first);
			for (size_type i = 1; i < LOGLOGN; ++i) {
				const size_type w = static_cast<size_type>(1) << i;
				for (size_type j = w; j < LOGN; j += w<<1) {
					traits::construct(alc, std::addressof(c[i][j]), c[0][j]);
					traits::construct(alc, std::addressof(c[i][j - 1]), c[0][j - 1]);
					for (size_type k = 1; k < w; ++k)
						traits::construct(alc, std::addressof(c[i][j - k - 1]),
							c[0][j - k - 1] + c[i][j - k]);
					for (size_type k = 1; k < w; ++k)
						traits::construct(alc, std::addressof(c[i][j + k]),
							c[i][j + k - 1] + c[0][j + k]);
				}
			}
		}
		template <class Allocator, class InputIterator>
		Brock(Allocator &alc, InputIterator first, const size_type limit) {
			using traits = std::allocator_traits<Allocator>;
			for (size_type i = 0; i < limit; ++i, ++first)
				traits::construct(alc, std::addressof(c[0][i]), *first);
			for (size_type i = 1; i < LOGLOGN; ++i) {
				const size_type w = static_cast<size_type>(1) << i;
				for (size_type j = w; j < limit; j += w<<1) {
					traits::construct(alc, std::addressof(c[i][j]), c[0][j]);
					traits::construct(alc, std::addressof(c[i][j - 1]), c[0][j - 1]);
					for (size_type k = 1; k < w; ++k)
						traits::construct(alc, std::addressof(c[i][j - k - 1]),
							c[0][j - k - 1] + c[i][j - k]);
					for (size_type k = 1; j + k < limit && k < w; ++k)
						traits::construct(alc, std::addressof(c[i][j + k]),
							c[i][j + k - 1] + c[0][j + k]);
				}
			}
		}
		value_type closed(size_type first, size_type last) const {
			if (first == last)
				return c[0][first];
			const size_type i = bsr32(first ^ last);
			return c[i][first] + c[i][last];
		}
		const_reference operator[](const size_type index) const {
			return c[0][index];
		}
	};

	std::array<std::array<value_type, B>, LOGB> table;
	std::array<Brock, B> brocks;
	const size_type size_;

public:
	template <class Allocator = std::allocator<Semigroup>>
	StaticRangeSum(const std::vector<Semigroup> &a, Allocator alc = Allocator())
		: size_(a.size()) {
		assert(size() <= N);
		using traits = std::allocator_traits<Allocator>;
		{
			size_type i;
			for (i = 0; (i + 1) << LOGLOGN <= size_; ++i) {
				new (std::addressof(brocks[i])) Brock(alc, a.begin() + (i << LOGLOGN));
				traits::construct(alc, std::addressof(table[0][i]),
					brocks[i].closed(0, LOGN - 1));
			}
			new (std::addressof(brocks[i]))
				Brock(alc, a.begin() + (i << LOGLOGN), size_ & (LOGN - 1));
		}
		const size_type t = size_ >> LOGLOGN;
		for (size_type i = 1; i < LOGB; ++i) {
			const size_type w = static_cast<size_type>(1) << i;
			for (size_type j = w; j < t; j += w<<1) {
				traits::construct(alc, std::addressof(table[i][j]), table[0][j]);
				traits::construct(alc, std::addressof(table[i][j - 1]),
					table[0][j - 1]);
				for (size_type k = 1; k < w; ++k)
					traits::construct(alc, std::addressof(table[i][j - k - 1]),
						table[0][j - k - 1] + table[i][j - k]);
				for (size_type k = 1; j + k < t && k < w; ++k)
					traits::construct(alc, std::addressof(table[i][j + k]),
						table[i][j + k - 1] + table[0][j + k]);
			}
		}
	}
	size_type size() const noexcept { return size_; }
	bool empty() const noexcept { return !size_; }
	value_type range(const size_type first, const size_type last) const {
		assert(first < size());
		assert(last <= size());
		assert(first < last);
		return closed(first, last - 1);
	}
	value_type closed(const size_type left, const size_type right) const {
		assert(left < size());
		assert(right < size());
		assert(left <= right);
		const size_type L = (left >> LOGLOGN) + 1;
		const size_type R = right >> LOGLOGN;
		if (L < R) {
			if (L + 1 < R) {
				const size_type i = bsr32(L ^ (R - 1));
				return brocks[L - 1].closed(left & (LOGN - 1), LOGN - 1) + table[i][L] +
					table[i][R - 1] + brocks[R].closed(0, right & (LOGN - 1));
			}
			else {
				return brocks[L - 1].closed(left & (LOGN - 1), LOGN - 1) + table[0][L] +
					brocks[R].closed(0, right & (LOGN - 1));
			}
		}
		else {
			if (L == R) {
				return brocks[L - 1].closed(left & (LOGN - 1), LOGN - 1) +
					brocks[R].closed(0, right & (LOGN - 1));
			}
			else {
				return brocks[R].closed(left & (LOGN - 1), right & (LOGN - 1));
			}
		}
	}
	const_reference operator[](const size_type index) const {
		assert(index < size());
		return brocks[index >> LOGLOGN][index & (LOGN - 1)];
	}
};

#include <algorithm>
#include <limits>
template <typename T> struct Mini {
	using value_type = T;
	T a;
	explicit Mini(const T &x = std::numeric_limits<T>::max()) : a(x) {}
	Mini operator+(const Mini &o) const { return Mini(std::min(a, o.a)); }
};
#include<cstdio>
#include<vector>
int main() {
	using M = Mini<int>;
	int n, l;
	scanf("%d%d", &n, &l);
	std::vector<M> a(n);
	for (auto &e : a)scanf("%d", &e);
	StaticRangeSum<M, 1000000> S(a);
	for (int i = 0;i <= n - l;++i)
		printf("%d%c", S.range(i, i + l).a, " \n"[i == n - l]);
	return 0;
}


Measured memory_bytes: 26680