You are given a permutation P_1 ... P_N of the set {1, 2, ..., N}.

You can apply the following operation to this permutation, any number of times (possibly zero):

* Choose two indices i,j (1 ≦ i < j ≦ N), such that j - i ≧ K and |P_i - P_j| = 1. Then, swap the values of P_i and P_j.



Among all permutations that can be obtained by applying this operation to the given permutation, find the lexicographically smallest one.

Constraints

* 2≦N≦500,000
* 1≦K≦N-1
* P is a permutation of the set {1, 2, ..., N}.

Input

The input is given from Standard Input in the following format:


N K
P_1 P_2 ... P_N


Output

Print the lexicographically smallest permutation that can be obtained.

Examples

Input

4 2
4 2 3 1


Output

2
1
4
3


Input

5 1
5 4 3 2 1


Output

1
2
3
4
5


Input

8 3
4 5 7 8 3 1 2 6


Output

1
2
6
7
5
3
4
8
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;

const int N = (int) 5e5 + 100;
#ifdef LOCAL
const int SZ = N;
#else
const int SZ = (int) 1e7 + 100;
#endif
int sz;

pair <int, int> edges[(int)(2.3 * SZ)];
int l[SZ], r[SZ];
int edSz;
int *degIn = r;
//int degIn[SZ];

int addV(int v, int tl, int tr, int pos, int val)
{
    if (tr == tl)
        return val;
   
    int cl = -1, cr = -1;
    if (v != -1)
    {
        cl = l[v];
        cr = r[v];
    }

    int nv = sz;
    l[nv] = cl;
    r[nv] = cr;
    sz++;

    int tm = (tl + tr) / 2;
    if (pos <= tm)
        l[nv] = addV(cl, tl, tm, pos, val);
    else
        r[nv] = addV(cr, tm + 1, tr, pos, val);

//    for (int to : {l[nv], r[nv]})
//        if (to != -1)
//            edges[edSz++] = make_pair(nv, to);

    return nv; 
}

void addEdges(int v, int tl, int tr, int sl, int sr, int from)
{
    if (v == -1 || sr < tl || tr < sl)
        return;

    //eprintf("addEdges(v = %d, tl = %d, tr = %d, sl = %d, sr = %d, from = %d)\n", v, tl, tr, sl, sr, from);
    if (sl <= tl && tr <= sr)
    {
        edges[edSz++] = make_pair(from, v);
        return;
    }
    int tm = (tl + tr) / 2;
    addEdges(l[v], tl, tm, sl, sr, from);
    addEdges(r[v], tm + 1, tr, sl, sr, from);
}

int p[N], pos[N];
int pans[N];

int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    int n, k;
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &p[i]);
        p[i]--;
        pos[p[i]] = i;
    }

    sz = n;

    memset(l, -1, sizeof l);
    memset(r, -1, sizeof r);

    int root = sz;
    //eprintf("init end\n"); 

    k--;
    for (int i = n - 1; i >= -k; i--)
    {
        //eprintf("i = %d\n", i);
        if (i >= 0)
        {
            int j = p[i];
            root = addV(root, 0, n - 1, j, i);
            //eprintf("v added\n");
        }
        
        if (k > 0 && i + k < n)
            addEdges(root, 0, n - 1, p[i + k] + 1, n - 1, i + k);
        
    }

    for (int i = 0; i < sz; i++)
    {
        if (l[i] != -1)
            edges[edSz++] = make_pair(i, l[i]);
        if (r[i] != -1)
            edges[edSz++] = make_pair(i, r[i]);
    }

    memset(r, 0, sizeof r);

    //if (sz > SZ || edSz > 2 * SZ) throw;
    //eprintf("g built\n");

    for (int i = 0; i < edSz; i++)
        swap(edges[i].first, edges[i].second);
    for (int i = 0; i < edSz; i++)
    {
        //eprintf("%d -> %d\n", edges[i].first, edges[i].second);
        degIn[edges[i].second]++;
    }
    sort(edges, edges + edSz);

    set <int> good;
    for (int i = 0; i < sz; i++)
        if (degIn[i] == 0)
        {
            //eprintf("init good = %d\n", i);
            good.insert(i);
        }

    vector <int> ans;

    while (!good.empty())
    {
        int v = *good.rbegin();
    //    if (v < n)
    //        v = *good.begin();
        good.erase(v);
    
    //    eprintf("v = %d\n", v);

        if (v < n)
        {
            ans.push_back(v);
        }

        int it = lower_bound(edges, edges + edSz, make_pair(v, -1)) - edges;
        while (it < edSz && edges[it].first == v)
        {
            int to = edges[it++].second;
        //for (int to : g[v])
            if (to != -1)
            {
                //eprintf("rm edge %d -> %d\n", v, to);
                degIn[to]--;
                if (degIn[to] == 0)
                {
                    //eprintf("new good = %d\n", to);
                    good.insert(to);
                }
            }
        }
    }

    reverse(ans.begin(), ans.end());

    for (int i = 0; i < n; i++)
        pans[ans[i]] = i;
    for (int i = 0; i < n; i++)
        printf("%d ", pans[i] + 1);
    printf("\n");
    //for (int x : ans)
    //    printf("%d ", x + 1);
    //printf("\n");
	return 0;
}


