#include<cstdio>
#include<cmath>
#include<climits>
#include<vector>
using namespace std;

int min(const int& a, const int& b){
    return a < b? a: b;
}
int getMinUtil(vector<int>& tree, const int& L, const int& R, const int& i, const int& l, const int& r){
    if(i >= tree.size() || l > r){
        return INT_MAX;
    }
    if(r < L || l > R){
        return INT_MAX;
    }
    if(l >= L && r <= R){
        return tree[i];
    }
    int m = l + (r - l)/2;
    return  min(getMinUtil(tree, L, R, 2*i+1, l, m), getMinUtil(tree, L, R, 2*i+2, m+1, r));
}

int getMin(vector<int>& tree, const int& n, const int& L, const int& R){
    return getMinUtil(tree, L, R, 0, 0, n-1);
}

vector<int> buildTree(vector<int>& A, const int& max_size, const int& n){
    vector<int> tree (max_size, INT_MAX);
    for(int i = 0; i < A.size(); i++){
        tree[i+n-1] = A[i];
    }
    for(int i = n-2; i >= 0; i--){
        tree[i] = min(tree[2*i+1], tree[2*i+2]);
    }
    return tree;
}

int main(){
    int n, l;
    scanf("%d %d", &n, &l);
    vector<int> A(n);
    for(int i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }
    int h = ceil(log2(n)) + 1;
    int max_size = pow(2, h) - 1;
    vector<int> tree = buildTree(A, max_size, pow(2, h-1));
    vector<int> res;
    for(int i = 0; i < n-l+1; i++){
        res.push_back(getMin(tree, pow(2, h-1), i, i+l-1));
    }
    for(int i = 0; i < res.size()-1; i++){
        printf("%d ", res[i]);
    }
    printf("%d\n", res[res.size()-1]);
}

