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<bits/stdc++.h>
using namespace std;
const int N=5e5+5;
int n,k,pos[N],a[N];
const int INF=0x3f3f3f3f;
struct SegT{
    int t[N<<2];
    void build(int x,int l,int r){
        int mid=(l+r)>>1;
        t[x]=INF;if(l==r)return ;
        build(x<<1,l,mid);build(x<<1|1,mid+1,r);
    }
    void chg(int x,int l,int r,int pos,int sum){
        int mid=(l+r)>>1;
        t[x]=min(t[x],sum);
        if(l==r)return;
        if(pos>mid)chg(x<<1|1,mid+1,r,pos,sum);
        else chg(x<<1,l,mid,pos,sum);
    }
    int qry(int x,int l,int r,int ql,int qr){
        if(ql>qr)return INF;
        int mid=(l+r)>>1,ans=INF;
        if(ql<=l&&qr>=r)return t[x];
        if(ql<=mid)ans=min(ans,qry(x<<1,l,mid,ql,qr));
        if(qr>mid)ans=min(ans,qry(x<<1|1,mid+1,r,ql,qr));
        return ans;
    }
}T;
int hed[N],to[N*3],nxt[N*3],cnt,d[N];
inline void adde(int u,int v){swap(u,v);++cnt;to[cnt]=v,nxt[cnt]=hed[u];hed[u]=cnt;d[v]++;}
priority_queue<int>Q;
int ans[N],top;
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        pos[a[i]]=i;
    }
    T.build(1,1,n);
    for(int i=n;i;i--){
        int p=pos[i];
        int R=T.qry(1,1,n,p+1,min(n,p+k-1));
        int L=T.qry(1,1,n,max(1,p-k+1),p-1);
        if(R<=n)adde(pos[i],pos[R]);
        if(L<=n)adde(pos[i],pos[L]);
        T.chg(1,1,n,pos[i],i);
    }
    for(int i=1;i<=n;i++)if(!d[i])Q.push(i);
    int top=0;
    while(!Q.empty()){
        int u=Q.top();Q.pop();
        ans[u]=++top;
        for(int i=hed[u];i;i=nxt[i]){
            int v=to[i];d[v]--;
            if(!d[v])Q.push(v);
        }
    }
    for(int i=1;i<=n;i++)printf("%d\n",n+1-ans[i]);
}
