Problem: For a given array $a_1, a_2, a_3, ... , a_N$ of $N$ elements and an integer $L$, find the minimum of each possible sub-arrays with size $L$ and print them from the beginning. For example, for an array $\\{1, 7, 7, 4, 8, 1, 6\\}$ and $L = 3$, the possible sub-arrays with size $L = 3$ includes $\\{1, 7, 7\\}$, $\\{7, 7, 4\\}$, $\\{7, 4, 8\\}$, $\\{4, 8, 1\\}$, $\\{8, 1, 6\\}$ and the minimum of each sub-array is 1, 4, 4, 1, 1 respectively.

Constraints

* $1 \leq N \leq 10^6$
* $1 \leq L \leq 10^6$
* $1 \leq a_i \leq 10^9$
* $L \leq N$

Input

The input is given in the following format.

$N$ $L$
$a_1$ $a_2$ ... $a_N$

Output

Print a sequence of the minimum in a line. Print a space character between adjacent elements.

Example

Input

7 3
1 7 7 4 8 1 6


Output

1 4 4 1 1

Solution (in CPP):

Solution:
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <cstdlib>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

template <class T>
struct swag {
  vector<T> data_front;
  vector<T> data_back;
  vector<T> func_front;
  vector<T> func_back;

  void clear() {
    data_front.clear();
    data_back.clear();
    func_front.clear();
    func_back.clear();
  }

  int size() {
    return data_front.size() + data_back.size();
  }

  void push(T x) {
    if (data_front.size() == 0) {
      data_front.push_back(x);
      func_front.push_back(x);
    }
    else {
      T f;
      if (func_back.size() == 0) f = x;
      else f = min(func_back[func_back.size()-1], x);
      data_back.push_back(x);
      func_back.push_back(f);
    }
  }

  void pop() {
    if (data_front.size() > 0) {
      data_front.pop_back();
      func_front.pop_back();
    }
    if (data_front.size() == 0) {
      int s = data_back.size();
      for (int i = 0; i < s; i++) {
        T x = data_back[data_back.size()-1];
        T f;
        if (func_front.size() == 0) f = x;
        else f = min(func_front[func_front.size()-1], x);
        data_front.push_back(x);
        func_front.push_back(f);
        data_back.pop_back();
        func_back.pop_back();
      }
    }
  }

  T fold_all() {
    if (func_front.size() == 0) return 0;
    else if (func_back.size() == 0) return func_front[func_front.size()-1];
    else return min(func_front[func_front.size()-1], func_back[func_back.size()-1]);
  }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, l;
  cin >> n >> l;
  vector<int> a(n);
  for (auto &x: a) cin >> x;

  swag<int> sw;
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    sw.push(a[i]);
    if (sw.size() >= l) {
      ans.push_back(sw.fold_all());
      sw.pop();
    }
  }

  for (int i = 0; i < (int)ans.size(); i++) {
    cout << ans[i];
    if (i < (int)ans.size() - 1) cout << " ";
    else cout << endl;
  }
}