The Festive Evening

题意翻译

七月底,果冻城堡举行节日晚会!来自王国各地的客人聚集在这里讨论糖果业的新趋势。然而,这里讨论的一些事情不应该向公众披露:这些信息可能会在斯威特兰王国引起不和,以防落入坏人之手。所以有必要不让任何不速之客进来。 果冻城堡有26个入口,上面有从A到Z的大写英文字母。由于安全措施,每个客人都被指定了一个入口,他应该通过这个入口进入城堡。每个入口的门在第一个客人到达前打开,在最后一个客人到达后关闭,最后一个客人应该通过这个入口进入城堡。两位客人不能同时进入城堡。 为了保护入口免受可能的入侵,应为其分配一个糖果警卫。城堡里有k这样的守卫,所以如果打开的门超过k,其中一个就会无人看守!注意一个警卫在他被指派的门关上之前不能离开他的岗位。 Slastyona怀疑晚上可能有不速之客。她知道被邀请的客人进入城堡的顺序,想让你帮她检查一下是否有超过千扇门被打开的时刻。 ## 输入格式 第一个行中给出了两个整数:来宾数n和守卫数k(1<=n<=10^6,1<=k<=26 )。 在第二行中, 给定n个大写英文字母 s1,s2…sn ,其中s [i] 是第i位客人使用的入口。 ## 输出格式 如果在一段时间内至少有一扇门无人看守,则输出“YES”,否则输出“NO”。

题目描述

![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF834B/2d6e5ec16532a3f3e53a73c083621a8744632e3d.png)It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here are not supposed to be disclosed to the general public: the information can cause discord in the kingdom of Sweetland in case it turns out to reach the wrong hands. So it's a necessity to not let any uninvited guests in. There are 26 entrances in Jelly Castle, enumerated with uppercase English letters from A to Z. Because of security measures, each guest is known to be assigned an entrance he should enter the castle through. The door of each entrance is opened right before the first guest's arrival and closed right after the arrival of the last guest that should enter the castle through this entrance. No two guests can enter the castle simultaneously. For an entrance to be protected from possible intrusion, a candy guard should be assigned to it. There are $ k $ such guards in the castle, so if there are more than $ k $ opened doors, one of them is going to be left unguarded! Notice that a guard can't leave his post until the door he is assigned to is closed. Slastyona had a suspicion that there could be uninvited guests at the evening. She knows the order in which the invited guests entered the castle, and wants you to help her check whether there was a moment when more than $ k $ doors were opened.

输入输出格式

输入格式


Two integers are given in the first string: the number of guests $ n $ and the number of guards $ k $ ( $ 1<=n<=10^{6} $ , $ 1<=k<=26 $ ). In the second string, $ n $ uppercase English letters $ s_{1}s_{2}...\ s_{n} $ are given, where $ s_{i} $ is the entrance used by the $ i $ -th guest.

输出格式


Output «YES» if at least one door was unguarded during some time, and «NO» otherwise. You can output each letter in arbitrary case (upper or lower).

输入输出样例

输入样例 #1

5 1
AABBB

输出样例 #1

NO

输入样例 #2

5 1
ABABB

输出样例 #2

YES

说明

In the first sample case, the door A is opened right before the first guest's arrival and closed when the second guest enters the castle. The door B is opened right before the arrival of the third guest, and closed after the fifth one arrives. One guard can handle both doors, as the first one is closed before the second one is opened. In the second sample case, the door B is opened before the second guest's arrival, but the only guard can't leave the door A unattended, as there is still one more guest that should enter the castle through this door.