Professor Ibrahim has prepared the final homework for his algorithm’s class. He asked his students to implement the Posterization Image Filter.

Their algorithm will be tested on an array of integers, where the i-th integer represents the color of the i-th pixel in the image. The image is in black and white, therefore the color of each pixel will be an integer between 0 and 255 (inclusive).

To implement the filter, students are required to divide the black and white color range [0, 255] into groups of consecutive colors, and select one color in each group to be the group’s key. In order to preserve image details, the size of a group must not be greater than k, and each color should belong to exactly one group.

Finally, the students will replace the color of each pixel in the array with that color’s assigned group key.

To better understand the effect, here is an image of a basking turtle where the Posterization Filter was applied with increasing k to the right. 

<image>

To make the process of checking the final answer easier, Professor Ibrahim wants students to divide the groups and assign the keys in a way that produces the lexicographically smallest possible array.

Input

The first line of input contains two integers n and k (1 ≤ n ≤ 10^5, 1 ≤ k ≤ 256), the number of pixels in the image, and the maximum size of a group, respectively.

The second line contains n integers p_1, p_2, ..., p_n (0 ≤ p_i ≤ 255), where p_i is the color of the i-th pixel.

Output

Print n space-separated integers; the lexicographically smallest possible array that represents the image after applying the Posterization filter.

Examples

Input

4 3
2 14 3 4


Output

0 12 3 3


Input

5 2
0 2 1 255 254


Output

0 1 1 254 254

Note

One possible way to group colors and assign keys for the first sample:

Color 2 belongs to the group [0,2], with group key 0.

Color 14 belongs to the group [12,14], with group key 12.

Colors 3 and 4 belong to group [3, 5], with group key 3.

Other groups won't affect the result so they are not listed here.
import java.util.*;


import java.io.*;
import java.lang.*;
import java.lang.reflect.Array;
import java.math.*;

public class Test
{
	static class pair implements Comparable<pair>
	 {
		Integer x,y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
		public int compareTo(pair o)
		{
			if(x<o.x)
				return -1;
			else
				return 1;
		}  
	}
	static int ans=0;
	static long mod=1000000007;
	static boolean prime[];
	public static void fill(int start,int end,int[] ans,int val)
	{
		for(int i=start;i<=end;i++)
			ans[i]=val;
	}
	public static int start(int p,int[] ans, int k)
	{
		for(int i=p;i>=Math.max(0,p-k+1);i--)
			if(ans[i]!=-1)
			{
				if(p-ans[i]<k)
					return i+1;
				return -1;
			}
		return -1;
	}
	public static void main(String args[])
	{
		InputReader in=new InputReader(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		int n=in.nextInt();
		int k=in.nextInt();
		int[] arr=in.nextIntArray(n);
		int[] ans=new int[300];
		int[] fn=new int[n];
		for(int i=0;i<300;i++)
			ans[i]=-1;
		for(int i=0;i<n;i++)
		{
			if(ans[arr[i]]!=-1)
				fn[i]=ans[arr[i]];
			else
			{
				if(ans[Math.max(0,arr[i]-k+1)]!=-1)
				{
					int start=start(arr[i],ans,k);
					if(start!=-1)
					{
						fill(start,arr[i],ans,ans[start-1]);
						fn[i]=ans[start-1];
					}
					else
					{
						for(int j=Math.max(0,arr[i]-k+1);j<=arr[i];j++)
						{
							if(ans[j]==-1)
							{
								fill(j,arr[i],ans,j);
								fn[i]=j;
								break;
							}
						}
					}
				}
				else
				{
					fill(Math.max(0, arr[i]-k+1),arr[i],ans,Math.max(0, arr[i]-k+1));
					fn[i]=Math.max(0, arr[i]-k+1);
				}
			}
		}
//		HashMap<Integer, Integer> map = new  HashMap<>();
//		HashMap<Integer, Integer> mp = new HashMap<>();
//		for(int i=0;i<n;i++)
//			map.put(i,arr[i]);
//		TreeSet<Integer> set = new TreeSet<>();
//		for(int i=0;i<n;i++)
//		{
//			if(i==0)
//			{
//				mp.put(arr[i], Math.max(0, arr[i]-k+1));
//				set.add(Math.max(0, arr[i]-k+1));
//				set.add(arr[i]);
//			}
//			else
//			{
//				int x=arr[i];
//				int p=-1;
//				int top=set.last();
//				if(top==x)
//					p=x;
//				else if(x-k+1<=0)
//					p=0;
//				else
//				{
//					if(x-k+1<=top)
//						p=top;
//					else
//						p=x-k+1;
//				}
//				mp.put(x, p);
//				set.add(p);
//			}
//		}
//		map.forEach((key, value) -> {
//			fn[key] = mp.get(value);
//		});
		for(int i=0;i<n;i++)
			pw.print(fn[i] + " ");
		pw.flush();
	}
	public static int distance(int x,int y,int p,int q)
	{
		int a=(x-p)*(x-p);
		int b=(y-q)*(y-q);
		int dis=a+b;
		return dis;
	}
	public static int bnum(int num)
	{
		int ans=0;
		for(int i=31;i>=0;i--)
		{
			if((num&(1<<i))!=0)
			{
				ans+=Math.pow(10,i);
			}
		}
		return ans;
	}
	public static int bsdown(int a[],int item)
	{
		int low=0,high=a.length-1,ans=-1;
		while(low<=high)
		{
			int mid=low+(high-low)/2;
			if(a[mid]<=item)
			{
				ans=mid;
				low=mid+1;
			}
			else
				high=mid-1;
				
		}
		return ans;
	}
	public static long inverse(long num)
	{
		return fastpow(num,mod-2,mod);
	}
	public static int bsupper(int a[],int item)
	{
		int low=0,high=a.length-1,ans=-1;
		while(low<=high)
		{
			int mid=low+(high-low)/2;
			if(a[mid]>=item)
			{
				ans=mid;
				high=mid-1;
			}
			else
				low=mid+1;
				
		}
		return ans;
	}	
	public static boolean isprime(int n)
	{
		for(int i=2;i*i<=n;i++)
		{
			if(n%i==0)
				return false;
		}
		return true;
	}
	public static long fact(long a,long mod)
	{
		long ans=1;
		for(int i=1;i<=a;i++)
		{
			ans*=i;
			ans%=mod;
		}
		return ans%mod;
		
	}
	public static long ncr(long n,long r,long mod)
	{
		long nom=1,dom=1;
		nom=(fact(n,mod))%mod;
		dom=(fact(r,mod)*fact(n-r,mod))%mod;
		return (nom*fastpow(dom,mod-2,mod))%mod;
	}
	public static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}
	public static void prime(int n)
	{
		prime[0]=true;
		prime[1]=true;
		for(int i=2;i*i<=n;i++)
		{
			if(prime[i])
				continue;
			for(int j=i;j*i<=n;j++)
			{
				prime[i*j]=true;
			}
		}
	}
	static class InputReader 
	{
		 
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) 
		{
			this.stream = stream;
		}

		public int snext() 
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) 
			{
				curChar = 0;
				try 
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e) 
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
		{
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() 
		{
			int c = snext();
			while (isSpaceChar(c)) 
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-') 
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) 
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++) 
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString() 
		{
			int c = snext();
			while (isSpaceChar(c)) 
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			}
			while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do 
			{
				res.appendCodePoint(c);
				c = snext();
			}
			while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) 
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) 
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter 
		{
			public boolean isSpaceChar(int ch);
		}
	}
	public static long fastpow(long a,long b,long mod)
	{
		long ans=1;
		while(b!=0)
		{
			if(b%2==1)
			{
				ans=(ans*a)%mod;
			}
			a=(a*a)%mod;
			b/=2;
		}
		return ans;
	}
}