[Image] 

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.


-----Input-----

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_1s_2... s_{n} are given, where s_{i} is the entrance used by the i-th guest.


-----Output-----

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).


-----Examples-----
Input
5 1
AABBB

Output
NO

Input
5 1
ABABB

Output
YES



-----Note-----

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.

Difficulty: interview

Starter code:

Solutions:
n, k = map(int, input().split())
s = input()
our = set()
opened = set()
for i in range(ord('A'), ord('Z') + 1):
    sym = chr(i)
    if sym in s:
        our.add(s.rfind(sym))
for i in range(len(s)):
    if s[i] not in opened:
        opened.add(s[i])
        k -= 1
        if k < 0:
            print('YES')
            return
    if i in our:
        k += 1
print('NO')

n,k=input().split()
n=int(n)
k=int(k)
l=input()
d={}
for val in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
	d[val]=0
for val in l:
	d[val]+=1
opened={}
flag=0
for val in l:
	if(val not in opened):
		opened[val]=1
	d[val]-=1
	if(len(opened)>k):
		flag=1
		break
	if(d[val]==0):
		del(opened[val])
if(flag==0):
	print("NO")
else:
	print("YES")

from string import ascii_uppercase as let
import sys


def main():
    n, k = map(int, input().split())
    l = input()
    a = [0 for i in range(26)]
    for i in l:
        a[let.index(i)] += 1
    fk = k
    od = set()
    for i in l:
        if i not in od:
            fk -= 1
            if fk < 0:
                print('YES')
                return
            od.add(i)
        a[let.index(i)] -= 1
        if a[let.index(i)] == 0:
            od.remove(i)
            fk += 1
    print('NO')
main()

n, k = list(map(int,input().split()))
s = input()
start = [-1]*26
end = [-1]*26

for i in range(n):
    door = ord(s[i])-ord('A')
    end[door] = i
    if start[door] == -1:
        start[door] = i

l = []
for i in range(26):
    l.append([i,1,start[i]])
    l.append([i,-1,end[i]])

l = sorted(l,key=lambda x: x[2])

num = 0
m = 0
for i in l:
    num += i[1]
    m = max(m,num)

if m > k:
    print('YES')
else:
    print('NO')


from sys import stdin, stdout
import string

n,k = list(map(int,stdin.readline().rstrip().split()))
s = list(stdin.readline().rstrip())

doorOpen = {}
doorClosed = {}

for i in range(n):
    if s[i] not in list(doorOpen.keys()):
        doorOpen[s[i]] = i

for i in range(n-1,-1,-1):
    if s[i] not in list(doorClosed.keys()):
        doorClosed[s[i]] = i

events = [(x,'o') for x in list(doorOpen.values())] + [(x,'x') for x in list(doorClosed.values())]

events.sort(key=lambda x: x[1])
events.sort(key = lambda x:x[0])


opened = 0
unguarded = False
for i in range(len(events)):
    if events[i][1]=='o':
        opened+=1
    else:
        opened-=1
    if opened>k:
        unguarded = True
        break

if unguarded:
    print('YES')
else:
    print('NO')
        


n,k = [int(i) for i in input().strip().split()]
g_l = input().strip()

closing_i = dict()
is_closing = [False for i in range(n)]
for i in range(n):
	i = n-i-1
	if g_l[i] not in closing_i:
		closing_i[g_l[i]] = i
		is_closing[i] = True
open_d = dict()
cur_open = 0
g_open = 0
for i in range(n):
	if g_l[i] not in open_d:
		open_d[g_l[i]] = True
		cur_open += 1
		g_open = max(cur_open,g_open)
	if is_closing[i]:
		cur_open -= 1
if g_open > k: print('YES')
else: print('NO')


n, k = [int(i) for i in input().split()]
a = input()
d = [[n + 1, 0] for i in range(26)]
for i in range(n):
    s = ord(a[i]) - ord('A')
    d[s][0] = min(d[s][0], i)
    d[s][1] = i
ev = []
for i in d:
    if i[0] != n + 1:
        ev.append([i[0], 0])
        ev.append([i[1], 1])
ev.sort()
b = 0
mb = 0
for i in range(len(ev)):
    if ev[i][1] == 1:
        b -= 1
    else:
        b += 1
    mb = max(mb, b)
print(['NO', 'YES'][int(mb > k)])


from sys import stdin

n, k = list(map(int, stdin.readline().rstrip().split()))
data = stdin.readline().rstrip()

doors = {}
for c in data:
    if c in doors:
        doors[c] += 1
    else:
        doors[c] = 1

opening_doors_count = 0
opened_doors = {}

for c in data:
    if c not in opened_doors:
        opened_doors[c] = True
        opening_doors_count += 1

    if opening_doors_count > k:
        print('YES')
        return

    doors[c] -= 1

    if doors[c] == 0:
        opening_doors_count -= 1
        opened_doors[c] = False

print('NO')


"""
	Author		: Arif Ahmad
	Date  		: 
	Algo  		: 
	Difficulty	: 
"""
from sys import stdin, stdout

def main():
	n, k = [int(_) for _ in stdin.readline().strip().split()]
	s = stdin.readline().strip()


	last = dict()
	for i in range(26):
		c = chr(ord('A') + i)
		for j in range(n-1, -1, -1):
			if s[j] == c:
				last[c] = j
				break

	guardAssigned = dict()
	for i in range(26):
		c = chr(ord('A') + i)
		guardAssigned[c] = False

	totalGuard = 0
	maxGuard = 0
	for i, c in enumerate(s):
		if not guardAssigned[c]:
			guardAssigned[c] = True
			totalGuard += 1
			maxGuard = max(maxGuard, totalGuard)
		if i == last[c]:
			totalGuard -= 1

	#print('maxgurad:', maxGuard)
	if maxGuard > k: stdout.write('YES\n')
	else: stdout.write('NO\n')


def __starting_point():
    main()

__starting_point()

n, k= input().split()
n, k= int(n), int(k)
s= input()
d= {}
f= {}
for i in range(65, 65+26):
    d[chr(i)]= 0
    f[chr(i)]= 0

for i in s:
    d[i]+=1

num= 0

for i in s:
    if(f[i]== 0):
        num+= 1
        if(num > k):
            print('YES')
            return
    f[i]+= 1
    if(f[i]== d[i]):
        num-= 1

print('NO')



n, k = list(map(int, input().split()))
s = list(input())

op = [n for _ in range(26)]
cl = [-1 for _ in range(26)]
for i in range(n):
    j = ord(s[i]) - ord("A")
    op[j] = min(op[j], i)
    cl[j] = max(cl[j], i)

cnt = [0 for _ in range(2 * n + 1)]
for i in range(26):
    if op[i] < n:
        cnt[op[i] * 2 + 1] += 1
    if -1 < cl[i]:
        cnt[cl[i] * 2 + 2] -= 1
for i in range(1, 2 * n + 1):
    cnt[i] += cnt[i - 1]

if k < max(cnt):
    print("YES")
else:
    print("NO")


string_len, condition_value = (int(x) for x in input().split())
idx___letter = list(input())

letter___start__finish = {}

for idx, letter in enumerate(idx___letter):
    if letter not in letter___start__finish:
        letter___start__finish[letter] = [idx, idx]
    if letter___start__finish[letter][1] < idx:
        letter___start__finish[letter][1] = idx

max_events_open = 0
curr_events_open = 0
for idx, letter in enumerate(idx___letter):
    start, close = letter___start__finish[letter]
    if idx == start:
        curr_events_open += 1
        max_events_open = max(max_events_open, curr_events_open)
    if idx == close:
        curr_events_open -= 1
if max_events_open > condition_value:
    print('YES')
else:
    print('NO')



#!/usr/bin/env python3
from sys import stdin, stdout

def rint():
    return list(map(int, stdin.readline().split()))
#lines = stdin.readlines()


n, k = rint()
s = input()
sl = {}
for i in range(len(s)):
    if not s[i] in sl:
        sl[s[i]] = [i,i]
    else:
        sl[s[i]][1] = i
cnt = 0
for i in range(len(s)):
    if sl[s[i]][0] == i:
        cnt+=1
    if cnt > k:
        print("YES")
        return
    if sl[s[i]][1] == i:
        cnt-=1

print("NO")




n,k = list(map(int,input().split()))
data = input()
d = {}
c = {}
for i in data:
    if i not in c:
        c[i]=1
    else:
        c[i]+=1
count = 0
m = 0
#print(c)
for i in data:
    #print(m,d,count)
    if i not in d: 
        count+=1
        d[i]=1
        m = max(m, count)
        if d[i]==c[i]:
            del d[i]
            count-=1        
    else:
        d[i]+=1
        if d[i]==c[i]:
            del d[i]
            count-=1
if m<=k :
    print('NO')
else:
    print('YES')


n, k = list(map(int, input().split()))
s = input()

cq = [0] * 26
do = [0] * 26

a = ord('A')

for i in s:
    cq[ord(i) - a] += 1

cntr = 0

for i in s:
    ind = ord(i) - a
    if do[ind] == 0:
        cntr += 1
    do[ind] += 1
    if cntr > k:
        print('YES')
        return
    if do[ind] == cq[ind]:
        cntr -= 1
    

print('NO')


n, k = list(map(int, input().split()))
s = input()

a = [None] * n
d = {}

for i in range(n):
    if s[i] not in d:
        a[i] = 1
        d[s[i]] = True

d.clear()
for i in range(n - 1, -1, -1):
    if s[i] not in d:
        if a[i] is None:
            a[i] = 0
        else:
            a[i] = -1
        d[s[i]] = True
c = 0
for el in a:
    if el is not None and el == 1:
        c += 1
    if el is not None and el == 0:
        c -= 1
    if el is not None and el == -1:
        if c + 1 > k:
            print('YES')
            return
    if c > k:
        print('YES')
        return
print('NO')


from collections import defaultdict as dd

a,k=[int(i) for  i in input().split()]
b=input()
al="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
come=[0]*(26)
out=[0]*(26)
for i in range(a):
    if come[al.index(b[i])]==0:
        come[al.index(b[i])]=i+1
        out[al.index(b[i])]=i+1
    else:
        out[al.index(b[i])]=i+1
cm=[]
for i in range(26):
    if come[i]!=0 and out[i]!=0:
        cm.append((come[i],1))
        cm.append((out[i],2))
cm.sort()
ma=0
ans=0
for i in cm:
    if i[1]==1:
        ma+=1
    else:
        ma-=1
    ans=max(ma,ans)
if (k>=ans):
    print("NO")
else:
    print("YES")
    



n, k = list(map(int, input().split()))
p = input()
ls, nlaps = [], 0
for i in range(65, 91):
    if chr(i) in p:
        start = p.index(chr(i))
        end = p.rfind(chr(i))
        ls.append((start,'start'))
        ls.append((end,'end'))
ls = list(sorted(ls, key=lambda x: x[0]))
# print(ls)
maxl = 0
for i,x in enumerate(ls):
    if x[1] == 'start':
        nlaps += 1
    else:
        nlaps -= 1
    maxl = max(maxl, nlaps)
if k >= maxl:
    print('NO')
else:
    print('YES')
    



from collections import defaultdict as dd

#milanmilanmilan
a,k=[int(i) for  i in input().split()]
b=input()
al="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
come=[0]*(26)
out=[0]*(26)
for i in range(a):
    if come[al.index(b[i])]==0:
        come[al.index(b[i])]=i+1
        out[al.index(b[i])]=i+1
    else:
        out[al.index(b[i])]=i+1
cm=[]
for i in range(26):
    if come[i]!=0 and out[i]!=0:
        cm.append((come[i],1))
        cm.append((out[i],2))
cm.sort()
ma=0
ans=0
for i in cm:
    if i[1]==1:
        ma+=1
    else:
        ma-=1
    ans=max(ma,ans)
if (k>=ans):
    print("NO")
else:
    print("YES")

from collections import defaultdict as dd

a,k=[int(i) for  i in input().split()]
b=input()
al="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
come=[0]*(26)
out=[0]*(26)
for i in range(a):
    if come[al.index(b[i])]==0:
        come[al.index(b[i])]=i+1
        out[al.index(b[i])]=i+1
    else:
        out[al.index(b[i])]=i+1
cm=[]
for i in range(26):
    if come[i]!=0 and out[i]!=0:
        cm.append((come[i],1))
        cm.append((out[i],2))
#hello hi hello hi heljishfihfiefef
#hello hi hello hi heljishfihfiefefhello hi hello hi heljishfihfiefef


#hello hi hello hi heljishfihfiefef
#hello hi hello hi heljishfihfiefef
#hello hi hello hi heljishfihfiefef

#hello hi hello hi heljishfihfiefef
#hello hi hello hi heljishfihfiefefhello hi hello hi heljishfihfiefef


#hello hi hello hi heljishfihfiefef
#hello hi hello hi heljishfihfiefef
#hello hi hello hi heljishfihfiefef
cm.sort()
ma=0
ans=0
for i in cm:
    if i[1]==1:
        ma+=1
    else:
        ma-=1
    ans=max(ma,ans)
if (k>=ans):
    print("NO")
else:
    print("YES")
#hello hi hello hi heljishfihfiefef
#hello hi hello hi heljishfihfiefefhello hi hello hi heljishfihfiefef


#hello hi hello hi heljishfihfiefef
#hello hi hello hi heljishfihfiefef
#hello hi hello hi heljishfihfiefef


n, k = [int(x) for x in input().split()]
guests = list(input())
doors = dict()
gt = dict()
opened = 0
f = True
for u in guests:
    gt[u] = gt.get(u, 0) + 1
for i in guests:
    if i not in doors:
        doors[i] = 1
        opened += 1
    else:
        doors[i] += 1
    if opened > k:
        print('YES')
        f = False
        break
    if doors[i] == gt[i]:
        opened -= 1
if f:
    print('NO')

n,k=(int(i )for i in input().split())
s=input()
a=[0]*n
b=[]
x=k
y=0
alf='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
end=[s.rfind(i) for i in alf]
begin=[s.find(i) for i in alf]

f=False
ans=False
for i in range(n):
    find=alf.find(s[i])
    if ((i!=end[find]) and not(s[i] in b)) or ((begin[find]==end[find])):
        b.append(s[i])
        x-=1;
    elif (i==end[find]) and  (i!=begin[find]):
        x+=1
    if x<0:
        ans=True
        break
    if begin[find]==end[find]:
        x+=1
print('YES' if ans else 'NO')


n, k = map(int, input().split())
s = input()
if k >= len(set(s)):
  print("NO")
  quit()
l = {}
for e in set(s):
  l[e] = len(s) - 1 - s[::-1].index(e)
g = set()
for x in range(n):
  if s[x] in g:
    if x >= l[s[x]]:
      k += 1
      g.discard(s[x])
  elif x >= l[s[x]]:
    if k > 0:
      continue
    else:
      print("YES")
      quit()
  else:
    g.add(s[x])
    k -= 1
    if k < 0:
      print("YES")
      quit()
print("YES" if k < 0 else "NO")

n, k = [ int(i) for i in input().split(' ')]
guests = input()
flag = 'NO'

guards = [' '] * k

for i in range(0, n):
	if guests[i] in guards:
		continue
	if ' ' in guards:
		guards[guards.index(' ')] = guests[i]
		continue
	rest_guests = guests[i:]
	flag = 'YES'
	for g in guards:
		if g in rest_guests:
			continue
		else:
			guards[guards.index(g)] = guests[i]
			flag = 'NO'
	if flag == 'YES':
		break
print(flag)