B. Array K-Coloring

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given an array aa consisting of nn integer numbers.

You have to color this array in kk colors in such a way that:

  • Each element of the array should be colored in some color;
  • For each ii from 11 to kk there should be at least one element colored in the ii-th color in the array;
  • For each ii from 11 to kk all elements colored in the ii-th color should be distinct.

Obviously, such coloring might be impossible. In this case, print "NO". Otherwise print "YES" and any coloring (i.e. numbers c1,c2,…cnc1,c2,…cn, where 1≤ci≤k1≤ci≤k and cici is the color of the ii-th element of the given array) satisfying the conditions above. If there are multiple answers, you can print any.

Input

The first line of the input contains two integers nn and kk (1≤k≤n≤50001≤k≤n≤5000) — the length of the array aa and the number of colors, respectively.

The second line of the input contains nn integers a1,a2,…,ana1,a2,…,an (1≤ai≤50001≤ai≤5000) — elements of the array aa.

Output

If there is no answer, print "NO". Otherwise print "YES" and any coloring (i.e. numbers c1,c2,…cnc1,c2,…cn, where 1≤ci≤k1≤ci≤k and cici is the color of the ii-th element of the given array) satisfying the conditions described in the problem statement. If there are multiple answers, you can print any.

Examples

input

Copy

4 2
1 2 2 3

output

Copy

YES
1 1 2 2

input

Copy

5 2
3 2 1 2 3

output

Copy

YES
2 1 1 2 1

input

Copy

5 2
2 1 1 2 1

output

Copy

NO

Note

In the first example the answer 2 1 2 12 1 2 1 is also acceptable.

In the second example the answer 1 1 1 2 21 1 1 2 2 is also acceptable.

There exist other acceptable answers for both examples.

题意:

给你一个数组和一个数K , (1). 要求该数组的每一个数都要被涂上颜色 。 (2). 相同数字的颜色不能一样 。(3). K个颜色必须被涂完。

不满足这些要求输出"NO" , 反之输出"YES"并输出任意一种涂色的方法。

思路:

数据范围不大 , 直接暴力。记录下数组的位置和出现的次数。逐个赋值。

数组中相同数字的个数不大于K , 不同数字数需大于K。

代码:

#include <bits/stdc++.h>
using namespace std;
int vis[5008][5008];
int main()
{
	int n , k , a , flag = 0 , flag1 = 0;
	int ret[5008] , op = 0;
	scanf("%d %d" , &n , &k);
	map<int , int> m;
	for(int i = 1 ; i <= n ; i++)
	{
		scanf("%d" , &a);
		m[a]++;
		vis[a][m[a]] = i;
		if(m[a] > k) flag = 1;
	}
	for(int i = 1; i <= 5000 ;  i++)
	{
		for(int j = 1 ; j <= m[i] ;j++)
		{
			ret[vis[i][j]] = ++op; 
			if(op == k)
			{
				flag1 = 1;
				op = 0;
			}
		}
	}
	if(flag == 1 || flag1 == 0)printf("NO\n");
	else
	{
		printf("YES\n");
		for(int i = 1 ; i < n ; i++)
		{
			printf("%d " , ret[i]);
		}
		printf("%d\n" , ret[n]);
	}
	return 0;
}