n, K = map(int, raw_input().split(' '))
s = raw_input()
mi, ma = {}, {}

for i in range(n):
	if s[i] not in mi:
		mi[s[i]] = i
		ma[s[i]] = i
	else:
		mi[s[i]] = min(i, mi[s[i]])
		ma[s[i]] = max(i, ma[s[i]])

l = []

for k in mi:
	l.append((mi[k], k, 0))
	l.append((ma[k], k, 1))

l.sort()

op = set()

for ti, door, st in l:
	if st:
		op.remove(door)
	else:
		op.add(door)
	if len(op) > K:
		print 'YES'
		exit()

print 'NO'
exit()

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 = 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')
        exit()

    doors[c] -= 1

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

print('NO')

n,r=map(int,input().split())
s=input()
x={}
y=set()
for j in range(n):
    x[s[j]]=j
for j in range(n):
    y.add(s[j])
    if(len(y)>r):
        print("YES")
        break
    if(j==x[s[j]]):
        y.remove(s[j])
if(len(y)<=r):
    print("NO")

guests, guards = map(int, raw_input().split())

gates_opened = {}
count = {}

seq = raw_input()

for g in seq:
    c = count.setdefault(g, 0)
    count[g] = c+1

# print(count)
def main():
    gates = 0
    for g in seq:
        count[g] -= 1
        # print(g, gates_opened)
        if not gates_opened.has_key(g):
            gates += 1
            gates_opened[g] = True
        if gates > guards:
            print('YES')
            return
        if gates_opened.has_key(g):
            if count[g] == 0:
                gates_opened.pop(g)
                gates -= 1

    print('NO')

if __name__ == '__main__':
    main()

guards_needed =0
flag=False
inp = raw_input().split()
n= int(inp[0])
k=int(inp[1])
stri=list(raw_input())
list1=[]
list2=[]
for i in range(26):
    list1.append(0)
for i in range(26):
    list2.append(False)
for char in stri:
    pos = ord(char)-65
    list1[pos]=list1[pos]+1
for char in stri:
    pos1=ord(char)-65
    if list2[pos1]==False:
        list2[pos1]=True
        guards_needed=guards_needed+1
        if guards_needed > k:
            flag = True
            break
    list1[pos1]=list1[pos1]-1
    if list1[pos1]==0:
        guards_needed=guards_needed-1
if flag==True:
    print "YES"
else:
    print "NO"

n,k=map(int,raw_input().split())
alpha=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

max_dict={}
guarded={}
current_dict={}
for i in alpha:
    max_dict[i]=0
    guarded[i] = 0
    current_dict[i] = 0
guests=list(raw_input())
for i in guests:
    max_dict[i]+=1

is_true=True
sum=0

for guest in guests:

    current_dict[guest]+=1
    if current_dict[guest]==1:

        sum+=1

    if sum>k:
        is_true=False
        print 'YES'
        break

    if current_dict[guest]==max_dict[guest]:
        sum-=1

if is_true==True:
    print 'NO'

n,k =  map(int,raw_input().split())
arr = raw_input()
flg = {}
far = [0]*(n+1)
for x in xrange(n):
	t = arr[x]
	if flg.get(t,-1) == -1:
		far[x] += 1
		flg[t] = x
	else:
		flg[t] = x
for x in flg.keys():
	far[flg[x]+1] -= 1
su = 0
f = 0

for x in xrange(n):
	su += far[x]
	if su > k:
		print 'YES'
		f = 1
		break
if f == 0:
	print 'NO'

R=raw_input
n,m=map(int,R().split())
s=R()
v=[0]*(n+1)
for x in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
  if x in s:
    v[s.index(x)]+=1
    v[s.rindex(x)+1]-=1
h=0
for i in xrange(n):
  h+=v[i]
  if h>m:
    print 'YES'
    break
else:
  print 'NO'

n,k = [int(_) for _ in raw_input().strip().split()]
string = raw_input().strip()
dau = [1000010]*260
cuoi = [-1]*260
result = [0]*(n+20)

A = ord('A')
for i in range(n):
  position = ord(string[i])
  dau[position] = min(dau[position],i)
  cuoi[position] = i
for i in range(26):
  if cuoi[i+A] != -1:
    result[dau[i+A]] += 1
    result[cuoi[i+A]+1] -= 1
for i in range(1,n):
  result[i] = result[i-1]+result[i]
value = max(result)
if value > k:
  print "YES"
else:
  print "NO"

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')
                sys.exit()
            od.add(i)
        a[let.index(i)] -= 1
        if a[let.index(i)] == 0:
            od.remove(i)
            fk += 1
    print('NO')
main()

from sys import stdin, stdout
import string

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

doorOpen = {}
doorClosed = {}

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

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

events = [(x,'o') for x in doorOpen.values()] + [(x,'x') for x in 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')

from collections import deque
from math import *
import heapq

# n=int(input())
n,k=map(int, input().split())
s=input()
d={}
e={}
for i in range(len(s)):
    d[s[i]]=i
    e[s[i]]=0

counter=0
for j in range(len(s)):
    # print(j,d[s[j]])
    if d[s[j]]!=j and e[s[j]]==0:
        e[s[j]]=1
        counter+=1
    elif d[s[j]]==j and e[s[j]]==0:
        counter+=1
        if counter>k:
            print("YES")
            exit()
        counter-=1
    elif d[s[j]]==j and e[s[j]]==1:
        counter-=1
    # print(counter)
    if counter>k:
        print("YES")
        exit()
print("NO")

#834B
n, k = map(int, input().split(" "))
s = input()
# ref = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# alpha = [0]*(n+1)
# for i in ref:
#     if i in s:
#         alpha[s.index(i)] += 1
#         alpha[s.rindex(i)+1] -= 1
# print(alpha)

# h = 0
# for j in range(n):
#     h += alpha[j]
#     if h>k:
#         print('YES')
#         break
# else:
#     print('NO')

last_pos = {}
active = set()

for i in range(n):
    last_pos[s[i]] = i

for i in range(n):
    active.add(s[i])
    if len(active) > k:
        print('YES')
        exit()
    if last_pos[s[i]] == i:
        active.remove(s[i])
print('NO')

n,k=map(int,input().split())
if n>k:
	s=input()

	counts=[0]*26
	offset=ord('A')
	for i in s:
		counts[ord(i)-offset]+=1
	is_closed=[None]*26
	count=26-counts.count(None)
	if k<count:
		for i in s:
			pos=ord(i)-offset
			if is_closed[pos]==None:
				if k>0:
					k-=1
					is_closed[pos]=False
				elif k==0:
					print("YES")
					break
			elif is_closed[pos]:
				print("YES")
				break
			counts[pos]-=1
			if counts[pos]==0:
				is_closed[pos]=True
				k+=1
		else:
			print("NO")
	else:
		print("NO")
else:
	print("NO")

l = input().split()

n = int(l[0])
k = int(l[1])

s = input()

lens = len(s)

first = []
fn = []
last = []
ln = []

for i in range(lens):
    if s[i] not in first:
        first.append(s[i])
        fn.append(i)
    if s[lens - i - 1] not in last:
        last.append(s[lens - i - 1])
        ln.append(lens - i - 1)
ln.sort()
more = False
d = 0
ad = None
rm = None
while not more:
    if ad == None:
        if len(fn)==0: break
        ad = fn.pop(0)
    if rm == None: rm = ln.pop(0)
    if ad < rm:
        d+=1
        ad = None
    elif ad > rm:
        d-=1
        rm = None
    else:
        ad=None
        rm=None
        if d+1 > k:
            more = True

    if d > k:
        more = True

if more:
    print("YES")
else:
    print("NO")

n,k = [int(_) for _ in raw_input().strip().split()]
string = raw_input().strip()
dau = [1000010]*26
cuoi = [-1]*26
result = [0]*(n+20)

A = ord('A')
for i in range(n):
  position = ord(string[i])-A
  dau[position] = min(dau[position],i)
  cuoi[position] = i
for i in range(26):
  if cuoi[i] != -1:
    result[dau[i]] += 1
    result[cuoi[i]+1] -= 1
for i in range(1,n):
  result[i] = result[i-1]+result[i]
value = max(result)
if value > k:
  print "YES"
else:
  print "NO"

#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

class FastI(BytesIO):
    newlines = 0

    def __init__(self, fd=0, bufsize=8192):
        self.fd = fd
        self.bufsize = bufsize
        self.read = lambda: super(FastI, self).read() if self.newlines else os.read(self.fd, os.fstat(self.fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b, ptr = os.read(self.fd, max(os.fstat(self.fd).st_size, self.bufsize)), self.tell()
            self.seek(0, 2), self.write(b), self.seek(ptr)
            self.newlines += b.count(b'\n') + (not b)

        self.newlines -= 1
        return super(FastI, self).readline()

class FastO(IOBase):
    def __init__(self, fd=1):
        stream = BytesIO()
        self.flush = lambda: os.write(fd, stream.getvalue()) and not stream.truncate(0) and stream.seek(0)
        self.write = stream.write if sys.version_info[0] < 3 else lambda b: stream.write(b.encode())

class ostream:
    def __lshift__(self, a):
        if a == endl:
            sys.stdout.write('\n')
            sys.stdout.flush()
        else:
            sys.stdout.write(str(a))
        return self

sys.stdin, sys.stdout = FastI(), FastO()
cout, endl = ostream(), object()

input = sys.stdin.readline

def main():
    n, k = map(int, input().split())
    s = input().rstrip(b'\r\n')

    o, c = [-1] * 26, [-1] * 26
    for i in range(n):
        if o[s[i] - 65] == -1:
            o[s[i] - 65] = i
        c[s[i] - 65] = i

    j = 0
    for i in range(n):
        if o[s[i] - 65] == i:
            j += 1
        if j > k:
            print('YES')
            return
        if c[s[i] - 65] == i:
            j -= 1

    print('NO')

if __name__ == '__main__':
    main()

n,k = map(int,input().split())
ll = input()
d = {}
for i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
    d[i] = 0
for i in ll:
    d[i] += 1
lll = {}
t = True
for i in ll:
    if i not in lll:
        lll[i] = 1
    d[i] -= 1
    if len(lll) > k:
        print('YES')
        t = False
        break
    if d[i] == 0:
        del lll[i]
if t == True:
    print('NO')

import sys
# from collections import deque
# from collections import Counter
# from math import sqrt
# from math import log
# from math import ceil
# from bisect import bisect_left, bisect_right

alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
# mod=10**9+7
# mod=998244353

# def BinarySearch(a,x):
# 	i=bisect_left(a,x)
# 	if(i!=len(a) and a[i]==x):
# 		return i
# 	else:
# 		return -1

# def sieve(n):
# 	prime=[True for i in range(n+1)]
# 	p=2
# 	while(p*p<=n):
# 		if (prime[p]==True):
# 			for i in range(p*p,n+1,p):
# 				prime[i]=False
# 		p+=1
# 	prime[0]=False
# 	prime[1]=False
# 	s=set()
# 	for i in range(len(prime)):
# 		if(prime[i]):
# 		s.add(i)
# 	return s

# def gcd(a, b):
# 	if(a==0):
# 		return b
# 	return gcd(b%a,a)

fast_reader=sys.stdin.readline
fast_writer=sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i)) for i in argv))
	fast_writer('\n')

#____________________________________________________________________________________________________________________________________

n,k=map(int, input().split())
s=input()
end={}
start={}
for i in range(len(s)):
	if(s[i] not in start):
		start[s[i]]=i
	end[s[i]]=i
st=list(start.values())
en=list(end.values())
st=set(st)
en=set(en)
c=0
f=True
for i in range(n):
	if(i in st):
		c+=1
	if(c>k):
		f=False
		break
	if(i in en):
		c-=1
if(f):
	print('NO')
else:
	print('YES')

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=map(int,input().split())
s=list(map(lambda x: ord(x)-ord('A'),input()))
c=[0]*26
o=[0]*26
for i in range(n):c[s[i]]+=1
for i in range(n):
    x=s[i]
    if o[x]==0:
        if k==0:print('YES');exit()
        k-=1
        o[x]=1
    c[x]-=1
    if c[x]==0:
        o[x]=0
        k+=1
print('NO')

from sys import stdin

OPEN = True
CLOSE = False

try:
    while True:
        doors = dict( (c,CLOSE) for c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' )
        guests, guards = tuple(map(int, input().split(' ', 2)))
        entries = input()
        close_door = dict( (c, entries.rfind(c)) for c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' )
        if guards >= len(doors):
            print('NO')
            continue
        if len(set(entries)) <= guards:
            print('NO')
            continue
        total_open = 0
        for index, door in enumerate(entries):
            if doors[door] == CLOSE:
                doors[door] = OPEN
                total_open += 1
            if total_open > guards:
                break
            if close_door[door] == index:
                doors[door] = CLOSE
                total_open -= 1
        if total_open > guards:
            print('YES')
        else:
            print('NO')
except EOFError:
    pass

n,k = [int(_) for _ in raw_input().strip().split()]
s = raw_input().strip()
l = set()
a = [0]*n
for i,_ in enumerate(s):
	if _ not in l:
		a[i] = 1
		l.add(_)

l = set()
b = [0]*n
for i in range(n-1,-1,-1):
	if s[i] not in l:
		b[i]+=1
		l.add(s[i])
sk = 0
found = False
for i in range(n):
	sk=sk+a[i]
	if sk>k:
		found = True
		break
	sk=sk-b[i]
print 'YES' if found else 'NO'

#!/usr/bin/python3

def main():
    n, g = [int(x) for x in input().split()]
    data = input()
    dats = set(data)

    if (len(dats) <= g): return "NO"

    inicio = []
    final = []

    for val in dats:
        inicio.append(data.index(val))

    dfls = list(dats)
    for end in range(n-1, -1, -1):
        if data[end] in dfls:
            final.append(end)
            dfls.remove(data[end])
        if (not len(dfls)): break

    inicio.sort()
    final.sort()

    total = 0
    i, f = 0, 0

    while (i < len(inicio)):
        if (inicio[i] <= final[f]):
            total += 1
            i += 1
        else:
            total -= 1
            f += 1

        if (total > g): return "YES"

    return "NO"

if __name__ == "__main__": print(main())

from collections import Counter

first = input()
n,k = first.split()
n = (int)(n)
k = (int)(k)

second = input()

guests = Counter(second)
guarded = set()
resv = k
flag = 1
for i in range(n):
    if(second[i] not in guarded):
        if(resv>0):
            guarded.add(second[i])
            resv-=1
        else:
            flag = 0
            break

    guests[second[i]]-=1
    if(guests[second[i]] == 0):
        resv+=1
        guarded.remove(second[i])

if(flag == 0):
    print("YES")
else:
    print("NO")

# -*- coding: utf-8 -*-
# from __future__ import division
import sys

n, k = [int(x) for x in sys.stdin.readline().split()]
s = sys.stdin.readline().strip()

A = ord('A')
first = [None] * 26
last = [None] * 26

letter_nums = [(ord(c) - A) for c in s]

for i in range(n):
	if first[letter_nums[i]] is None:
		first[letter_nums[i]] = i
	last[letter_nums[i]] = i

cur_n_segments = 0
good = True

for i in range(n):
	if first[letter_nums[i]] == i:
		cur_n_segments += 1
		if cur_n_segments > k:
			print 'YES'
			good = False
			break
	if last[letter_nums[i]] == i:
		cur_n_segments -= 1
if good:
	print 'NO'

n,k=map(int,input().split())
s=input()
mx=dict()
for x in range(n):
    mx[s[x]]=x
cur=0
ans=0
c={x.upper():0 for x in 'qwertyuiopasdfghjklzxcvbnm'}
for x in range(n):
    if c[s[x]]==0:
        cur+=1
        c[s[x]]=1

    if cur > k:
        ans=1
    #print(cur,x,s[x])
    if mx[s[x]]==x:
        cur-=1
        c[s[x]]=0
print('NO' if not ans else 'YES')

arr = list(map(int,input().split()))
total_g = arr[0]
guards = arr[1]
close_gate = dict()
entry = input()
changes = 0

for i in range(0,total_g):
    if entry[i] in close_gate:
        close_gate[entry[i]] = close_gate[entry[i]] + 1
    else:
       close_gate[entry[i]] =  1

cnt_gate = dict()
avg = guards
flag = 0

for i in range(0,total_g):
    # print(entry[i])
    if entry[i] not in cnt_gate:
        if avg==0 and i!=0 and cnt_gate[entry[i-1]] != close_gate[entry[i-1]]:
            print('YES')
            flag = 1
            break

        # print("new gate opened")
        cnt_gate[entry[i]] = 1
        avg = avg -1
        # print(cnt_gate[entry[i]],close_gate[entry[i]])
        # print('guards available',avg)
        if cnt_gate[entry[i]] == close_gate[entry[i]]:
            avg = avg + 1

    else :
        cnt_gate[entry[i]] = cnt_gate[entry[i]] + 1
        if cnt_gate[entry[i]] == close_gate[entry[i]]:
            # print('gate was',entry[i], 'closed')
            avg = avg + 1

if flag == 0:
    print('NO')

n,k=map(int,raw_input().split())
e=raw_input()
a=[[-1,-1] for i in xrange(26)]
for i in xrange(n):
	if a[ord(e[i])-ord('A')][0]==-1:
		a[ord(e[i])-ord('A')][0]=i
		a[ord(e[i])-ord('A')][1]=i
	else:
		a[ord(e[i])-ord('A')][1]=i
#print a
z=[0]*n
z1=[0]*n
#print z
for i in xrange(26):

	if a[i][0]!=-1:
		#print a[i][0],a[i][1]
		z[a[i][0]]=1
		z1[a[i][1]]=-1
#print z
zz=0
pos=1
for i in xrange(n):
	zz+=z[i]
	if zz>k:
		pos=0
	zz+=z1[i]
if pos==0:
	print 'YES'
else:
	print 'NO'

n,k=map(int,str(raw_input()).split())
s=str(raw_input())
d={}
for i in range(65,91):
    d[chr(i)]=[0,0]
for i in range(n):
    if d[s[i]][0]==0:
        d[s[i]][0]=i+1
    else:
        d[s[i]][1]=i+1
for i in d:
    if d[i][0]!=0 and d[i][1]==0:
        d[i][1]=d[i][0]
open=0
flag=1
for i in range(n):
    if d[s[i]][0]==i+1:
        open+=1
    if open>k:
        flag=0
    if d[s[i]][1]==i+1:
        open-=1
    if open>k:
        flag=0
    #print d[s[i]][1],i+1
    #print open

if flag:
    print "NO"
else:
    print "YES"

#print d

from math import inf,sqrt,floor,ceil
from collections import Counter,defaultdict,deque
from heapq import heappush as hpush,heappop as hpop,heapify as h
from operator import itemgetter
from itertools import product
from bisect import bisect_left,bisect_right

n,k=map(int,input().split( ))
s=input()
last=Counter()
for i in range(n):
    last[s[i]]=i
first=set()
ans="NO"
for i in range(n):
    if s[i] not in first:
        first.add(s[i])
    if len(first)>k:
        ans="YES"
        break
    if last[s[i]]==i:
        first.discard(s[i])
print(ans)

n, k = map(int, input().split())
g = tuple(map(ord, input()))

e = [-1] * 91

for i in range(n):
    e[g[i]] = i
curS = 0
f = 1
met = [0] * 91
for i in range(n):
    if met[g[i]]:
        if i == e[g[i]]:
            curS -= 1
        continue
    curS += 1
    met[g[i]] = 1
    if curS > k:
        f = 0
        break
    if i == e[g[i]]:
        curS -= 1

if f: print("NO")
else: print("YES")

n, k = map(int, input().split())
G = input()
g = [0] * n

e = [-1] * 91

for i in range(n):
    g[i] = ord(G[i])
    e[g[i]] = i
curS = 0
f = 1
met = [0] * 91
for i in range(n):
    if not met[g[i]]:
        curS += 1
        met[g[i]] = 1
    if curS > k:
        f = 0
        break
    if i == e[g[i]]:
        curS -= 1

if f: print("NO")
else: print("YES")

n, k = map(int, input().split())
g = tuple(map(ord, input()))

e = [-1] * 91

for i in range(n):
    e[g[i]] = i
curS = 0
f = True
met = [False] * 91
for i in range(n):
    if not met[g[i]]:
        curS += 1
        met[g[i]] = True
    if curS > k:
        f = False
        break
    if i == e[g[i]]:
        curS -= 1

if f: print("NO")
else: print("YES")

m,n = map(int,raw_input().split())
a = []
positions = {}
s = raw_input()
ml = 0
for i in range(m):
	try:
		positions[s[i]] = [positions[s[i]][0],i]
	except:
		positions[s[i]]=[i,i]
#print(positions)
a = []
assing_gard = 0
max_a = 0
for i in range(m-1):
	if s[i] not in a:
		assing_gard += 1
		#print(assing_gard)
		if assing_gard > max_a:
			max_a = assing_gard
		a.append(s[i])
	if positions[s[i]][1] == i:
		assing_gard -= 1

if max_a > n:
	print("YES")
else:
	print("NO")

# -*- coding: utf-8 -*-

# Baqir Khan
# Software Engineer (Backend)

from sys import stdin

inp = stdin.readline

n, k = map(int, inp().split())
s = inp()[:-1]
out_time = [-1] * 26
in_time = [-1] * 26

for i in range(n):
    if in_time[ord(s[i]) - ord("A")] == -1:
        in_time[ord(s[i]) - ord("A")] = i

for i in range(n - 1, -1, -1):
    if out_time[ord(s[i]) - ord("A")] == -1:
        out_time[ord(s[i]) - ord("A")] = i

requirement = [0] * (n + 1)

for i in range(26):
    if in_time[i] != -1:
        requirement[in_time[i]] += 1
        requirement[out_time[i] + 1] -= 1

cur_sum = 0
for i in range(n):
    cur_sum += requirement[i]
    requirement[i] = cur_sum

print("NO" if max(requirement) <= k else "YES")

n, k = map(int, input().split())
g = input()

e = [-1] * 91

for i in range(n):
    e[ord(g[i])] = i
curS = 0
f = 1
met = [0] * 91
for i in range(n):
    if not met[ord(g[i])]:
        curS += 1
        met[ord(g[i])] = 1
    if curS > k:
        f = 0
        break
    if i == e[ord(g[i])]:
        curS -= 1

if f: print("NO")
else: print("YES")

n, k = map(int, input().split())
s = input()
arr = dict()
arr_ = dict()
ans = 'NO'
for i in range(65, 91):
    arr[chr(i)] = 0
    arr_[chr(i)] = 0
for i in s:
    arr_[i] += 1
for i in s:
    if arr[i] == 0:
        k -= 1
    arr[i] += 1
    if k < 0:
        ans = 'YES'
    if arr[i] == arr_[i]:
        k += 1
print(ans)

n, k = map(int, input().split())
s = input()
Open, Close = [-1 for i in range(26)], [-1 for i in range(26)]
ope = 0
Bool = True
for i in range(n):
    curr = ord(s[i]) - ord('A')
    if Open[curr] == -1:
        Open[curr] = i
        Close[curr] = i
    else:
        Close[curr] = i

for i in range(n):
    if i in Open:
        ope += 1
    if ope > k:
        Bool = False
        break
    if i in Close:
        ope -= 1
print("NO") if Bool else print("YES")

gates={}
state_gates={}

def main(n,l,gates,state_gates,guards): #str,str int
    for i in range(n):
        gate=l[i]
        if state_gates[gate]!=True:
            if guards>0:
                state_gates[gate]=True
                guards-=1
            else:
                return "YES"

        if gates[gate][1]==i:
            state_gates[gate]=False
            guards+=1
    else:return "NO"

g=raw_input().split()
guards=int(g[1])
l=raw_input()
n=int(g[0])
for i in range(n):
    if gates.has_key(l[i]):gates[l[i]][1]=i
    else:gates[l[i]]=[i,i]

    state_gates[l[i]]=False   #True=open   False=close

print main(n,l,gates,state_gates,guards)

n, k = map(int, input().split())
g = tuple(map(ord, input()))

e = [None] * 91

for i in range(n):
    e[g[i]] = i
curS = 0
f = 1
met = [None] * 91
for i in range(n):
    if met[g[i]]:
        if i == e[g[i]]:
            curS -= 1
        continue
    if i == e[g[i]]:
        if curS + 1 > k:
            f = 0
            break
        continue
    curS += 1
    met[g[i]] = 1
    if curS > k:
        f = 0
        break
if f: print("NO")
else: print("YES")

guest, guard = [int(x) for x in input().strip().split(" ")]
list = [x for x in input().strip()]
first = {}
last = {}
for i, c in enumerate(list):
    if c not in first:
        first[c] = i
    last[c] = i

posCount = []
current = 0
for i,c in enumerate(list):
    if first[c] == i:
        current += 1
    posCount.append(current)
    if last[c] == i:
        current -=1

if max(posCount) > guard:
    print("yes")
else:
    print("no")

n,k=map(int,raw_input().split())
inp=raw_input()

ends={chr(i):-1 for i in range(65,91)}
opened={chr(i):0 for i in range(65,91)}
opened_gates=0
ans=0
for i in range(n-1,-1,-1):
    if ends[inp[i]]==-1:
        ends[inp[i]]=i

for i in range(n):
    if not opened[inp[i]]:
        opened[inp[i]]=1
        opened_gates+=1
        ans=max(ans,opened_gates)

    if ends[inp[i]]==i:
        opened[inp[i]]=0
        opened_gates-=1
        ans=max(ans,opened_gates)

if ans>k:
    print "YES"

else:
    print "NO"

import sys
a=[]

for x in raw_input().split():
    a.append(int(x))

n=a[0]
k=a[1]
pos=[0]*300

s=raw_input();
for i in range(len(s)):
    pos[ord(s[i])]=i

ans="NO"
size=0
mp={}
for i in range(len(s)):
    if(mp.has_key(s[i])):
        if(pos[ord(s[i])]==i):size=size-1
    else:
        mp[s[i]]=1
        size=size+1
        if(size>k):
            ans="YES"
        if(pos[ord(s[i])]==i):size=size-1

print ans

n, k = map(int, input().split())
entrances = input()
di = {}
s = set()
for i in range(n): di[entrances[i]] = i

for i in range(n):
    s.add(entrances[i])
    if len(s)>k:
        print("YES")
        break
    if di[entrances[i]]==i:
        s.remove(entrances[i])
else:
    print("NO")

def FindIfGuarded(k, n, s):
	alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	count1 = {}
	count2 = {}
	for ch in alphabet:
		count1[ch] = 0
		count2[ch] = 0
	for ch in s:
		count1[ch] += 1
	NumOfOpenGates = 0
	for ch in s:
		if count2[ch] == 0:
			if NumOfOpenGates == k:
				return 'Yes'
			NumOfOpenGates += 1
		if count2[ch] == count1[ch]-1:
			NumOfOpenGates -= 1
		count2[ch] += 1
	return 'No'

n, k = map(int, raw_input().split(' '))
s = raw_input()

print (FindIfGuarded(k, n, s))

n, k = map(int, input().split())
entrances = input()
d = {}
s = set()
for i in range(n): d[entrances[i]] = i

for i in range(n):
    s.add(entrances[i])
    if len(s)>k:
        print("YES")
        break
    if d[entrances[i]]==i:
        s.remove(entrances[i])
else:
    print("NO")

def helper():
	n, k = map(int, raw_input().split())
	s = raw_input()
	end_index = {}
	guard = 0
	is_guard = {}
	for i, v in enumerate(reversed(s)):
		if v in end_index:
			continue
		end_index[v] = len(s) - i - 1

	# print end_index
	for i, v in enumerate(s):
		if v in is_guard and i != end_index[v]:
			# not end work
			continue
		if not v in is_guard:
			guard += 1
			is_guard[v] = 1
		if guard > k:
			return 'YES'
		if i == end_index[v]:
			guard -= 1
		# print i, ': ', guard
	return 'NO'
print helper()

import sys
nums = list(map(int, sys.stdin.readline().split()))
e = list(map(str, sys.stdin.readline().rstrip("\n")))

k = nums[1]
c = [0] * 26

for x in range(len(e)):
    c[ord(e[x]) - 65] += 1

sec = [0]*len(c)
i = 0
count = 0

while i < len(e):
    if sec[ord(e[i])-65] == 0:
        count += 1
    sec[ord(e[i])-65] = 1
    if count > k:
        print("YES")
        exit(0)
    c[ord(e[i])-65] -= 1
    if c[ord(e[i])-65] == 0:
        sec[ord(e[i])-65] = 0
        count -= 1
    i += 1

print("NO")

n, k = map(int, input().split())
g = input().encode()

e = [-1] * 26

for i in range(n):
    e[g[i] - 65] = i
curS = 0
f = 1
met = [0] * 26
for i in range(n):
    if not met[g[i] - 65]:
        curS += 1
        met[g[i] - 65] = 1
    if curS > k:
        f = 0
        break
    if i == e[g[i] - 65]:
        curS -= 1

print('NO' if f else 'YES')

# cook your dish here

n,k=map(int,input().split())
st=input()
s=set(st)
ans=0
d=[0]*n
for i in s:
    for j in range(st.find(i),st.rfind(i)+1):
        d[j]+=1

if(max(d)>k):
    print("YES")
else:
    print("NO")

n,k = 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=(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')

from collections import Counter

if __name__ == '__main__':
    n, k = list(map(int, input().split()))
    q = input()

    last_index, first_index = {}, {}
    for i, s in enumerate(q):
        last_index[s] = i
        first_index[s] = min(first_index.get(s, 10**6 +5), i)

    opened_count = 0
    for i, d in enumerate(q):
        if i == first_index[d]:
            opened_count += 1
        if opened_count > k:
            print('YES')
            exit(0)
        if i == last_index[d]:
            opened_count -= 1

    print('NO')

n, k = map(int, input().split())
s = input()
d = {}
op = set()
for i in range(len(s)):
    d[s[i]] = i
ans = 0
doors = 0
for i in range(len(s)):
    if s[i] not in op:
        doors += 1
        op.add(s[i])
    ans = max(ans, doors)
    if i == d[s[i]]:
        doors -= 1
print(('YES','NO')[ans <= k])

import sys
input = sys.stdin.readline

def main():
  n, k = map(int, input().split())
  guests = input().rstrip()
  guestbook = {guest: idx for idx, guest in enumerate(guests)}

  s = set ()
  for idx, guest in enumerate(guests):
    if guest not in s: s.add(guest)
    if len(s) > k:
      print("YES")
      return
    if guestbook[guest] == idx: s.remove(guest)
  print("NO")

if __name__ == "__main__":
  main()

import sys
input = sys.stdin.readline

""" Interval intersection """

def main():
  n, k = map(int, input().split())
  guests = input().rstrip()
  guestbook = {}
  for idx, guest in enumerate(guests):
    if guest not in guestbook:
      guestbook[guest] = (idx, idx)
    else:
      val = guestbook[guest]
      guestbook[guest] = (val[0], idx)

  timeline = [0]*n
  for timings in guestbook.values():
    for idx in range(timings[0], timings[1]+1):
      timeline[idx] += 1

  print("YES") if max(timeline) > k else print("NO")

if __name__ == "__main__":
  main()

n,k = map(int,raw_input().split())
s = raw_input()
guests = {}
we_gooch = True
for letter in s:
  if letter not in guests:
    guests[letter] = 1
  else:
    guests[letter] += 1
unique_doors = set()
for letter in s:
  unique_doors.add(letter)
  if len(unique_doors) > k:
    we_gooch = False
  guests[letter]-=1
  if guests[letter] == 0:
    unique_doors.remove(letter)
if we_gooch:
  print 'NO'
else:
  print 'YES'

n, k = map(int, input().split())
doors = input()

lo = [-1] * 26

for i in range(len(doors)):
    cc = ord(doors[i]) - ord('A')
    lo[cc] = i

opened = set()

exceeded = False

for i in range(len(doors)):
    cc = ord(doors[i]) - ord('A')
    opened.add(cc)

    if len(opened) > k:
        exceeded = True
        break

    if i == lo[cc]:
        opened.remove(cc)

print("YES" if exceeded else "NO")

n,k = map(int, raw_input().split())
a = list(raw_input())
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

m = {}
given = {}
for i in alp:
	m[i] = -1
	given[i] = 0
for i in range(len(a)-1,-1,-1):
	if(m[a[i]]==-1):
		m[a[i]] = i
gates = 0
guards = k-1
given[a[0]] = 1

for i in range(0,len(a)):
	if(given[a[i]]):
		pass
	else:
		given[a[i]]=1
		guards-=1
	if(guards<0):
		gates+=1
		break
	if(m[a[i]]==i):
		guards+=1
if(gates==1):
	print "YES"
else:
	print "NO"

from operator import itemgetter as it
n, k = map(int, raw_input().split())
S = raw_input()
start = [-1] * 26
end = [-1] * 26
for i in xrange(n):
    c = S[i]
    num = ord(c) - 65
    if start[num] == -1: start[num] = i
    end[num] = i

s = set()
q = []
for i in xrange(26):
    q.append((i, start[i], 's'))
    q.append((i, end[i], 'e'))
q.sort(key=it(1))

for ele in q:
    no, p, t = ele
    if t == 's':
        s.add((no, 'e'))
    else:
        s.remove((no, 'e'))
    if len(s) > k:
        print 'YES'
        break
else:
    print 'NO'

R = lambda:map(int,raw_input().split())

n,k = R()
s = raw_input()
netk= k
carr= 26*[0]
ass = 26*[False]

for i in xrange(n):
    carr[ord(s[i])-ord('A')]+=1

for i in xrange(n):
    c = ord(s[i])-ord('A')
    carr[c]-=1
    if not ass[c]:
	ass[c]=True
	netk-=1
    if netk < 0:
	print "YES"
	exit(0)
    if ass[c] and carr[c]==0:
	netk+=1
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=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")

import os

def main():
    s = os.read(0, os.fstat(0).st_size).split()

    n, k = int(s[0]), int(s[1])
    g = [x - 65 for x in s[2]]

    e = [-1] * 26
    for i in range(n):
        e[g[i]] = i
    curS = 0
    f = 1
    met = [0] * 26
    for i in range(n):
        if not met[g[i]]:
            curS += 1
            met[g[i]] = 1
        if curS > k:
            f = 0
            break
        if i == e[g[i]]:
            curS -= 1

    print('NO' if f else 'YES')

main()

import os
from io import BytesIO

def main():
    input = BytesIO(os.read(0, os.fstat(0).st_size)).readline

    n, k = map(int, input().split())
    g = [x - 65 for x in input()]

    e = [-1] * 26

    for i in range(n):
        e[g[i]] = i
    curS = 0

    met = [0] * 26
    for i in range(n):
        if not met[g[i]]:
            curS += 1
            met[g[i]] = 1
        if curS > k:
            print('YES')
            return
        if i == e[g[i]]:
            curS -= 1

    print('NO')

main()

import io, os
def main():
    input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
    n, k = map(int, input().split())
    g, e = [x - 65 for x in input()], [-1] * 26
    for i in range(n): e[g[i]] = i
    curS, met = 0, [0] * 26
    for i in range(n):
        if not met[g[i]]: curS += 1; met[g[i]] = 1
        if curS > k: os.write(1, b'YES'); exit()
        if i == e[g[i]]: curS -= 1
    os.write(1, b'NO')
main()

def main(n, k, s):
    last = {}
    for i in range(n - 1, -1, -1):
        j = ord(s[i]) - ord('A')
        if j not in last:
            last[j] = i
    se = set()
    for i, c in enumerate(list(map(lambda i: ord(i) - ord('A'), s))):
        if c not in se:
            se.add(c)
        if len(se) > k:
            return "YES"
        if i == last[c]:
            se.remove(c)
    return "NO"

print(main(*list(map(int, input().split(' '))), input()))

n,k=map(int,input().split())
l=list(input())
d={}
for i in range(n):
    d[l[i]]=[0,i]
ac=0
for i in range(n):
    if d[l[i]][0]==0:
        ac+=1
        d[l[i]][0]=1
    if ac>k:
        print("YES")
        break
    if d[l[i]][1]==i:
        ac-=1
else: print("NO")

# Idea is to find first and last indices of all doors
# It will be time when door opens and time when door closes and guardian can leave

def main():
    opened = {}
    closed = {}

    n, k = map(int, input().split())
    seq = input()

    for i, way in enumerate(seq):
        if way not in opened:
            opened[way] = i
        closed[way] = i # Door can be closed after 1 person in

    for i, way in enumerate(seq):
        open_ith_door = opened[way] == i
        if open_ith_door:
            k -= 1
            no_guardians = k < 0
            if no_guardians:
                print("YES")
                return

        close_ith_door = closed[way] == i
        if close_ith_door:
            k += 1
        else:
            continue

    print("NO")
    return

main()

n,k=map(int,input().split())
s=input()
flag=False
last_pos={}
gate=set()
for i in range(len(s)):
    last_pos[s[i]]=i
#print(last_pos)
for i in range(len(s)):
    gate.add(s[i])
    if len(gate)>k:
        flag=True
        break
    if last_pos[s[i]]==i:
        gate.remove(s[i])
if flag:
    print('YES')
else:
    print('NO')

from collections import Counter

def main():
    n, k = map(int, input().split())
    s = input()

    ocnt = Counter(s)
    cnt = ocnt.copy()

    i = 0
    for e in s:
        if cnt[e] == ocnt[e]:
            i += 1
            if i > k:
                print('YES')
                return

        cnt[e] -= 1
        if cnt[e] == 0:
            i -= 1

    print('NO')

if __name__ == '__main__':
    main()

def main ():
  n, k = [int(n) for n in input().split()]
  S = input();
  doors = {}

  for i, s in enumerate(S):
    doors[s] = i

  activeDoors = set();
  for i, s in enumerate(S):
    if doors[s] == i:
      activeDoors.add(s);
      if(len(activeDoors) > k):
        return "YES"
      activeDoors.remove(s);
    else:
      activeDoors.add(s);
      if(len(activeDoors) > k):
          return "YES"

  return "NO"

print(main())

n, k = map(int, input().split())
s = str(input())
m = {}
z = set()

for i, t in enumerate(s):
	m[t] = i

for i, t in enumerate(s):
	if m[t] != i:
		z.add(t)
		if len(z) > k:
			print('YES')
			exit()
	else:
		if t in z:
			z.remove(t)
		elif len(z) + 1 > k:
			print('YES')
			exit()

print('NO')

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

letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

quards = {letters[i]: 0 for i in range(26)}

for i in range(n):
    quards[s[i]] += 1

d = []
for key, value in quards.items():
    if not value:
        d.append(key)
for key in d:
    del quards[key]

ready = k
now = []
flag = True
for man in s:
    # print(man, now, ready)
    if man not in now:
        if ready:
            ready -= 1
            now.append(man)
        else:
            print('YES')
            flag = False
            break
    quards[man] -= 1
    if not quards[man]:
        ready += 1
        now.remove(man)
    # print(quards, ready, now)
    # print()
if flag:
    print('NO')

first_line = input().strip()

n = int(first_line.split()[0])
k = int(first_line.split()[1])

n_line = input().strip()

guest_doors = []

door_dict = {}
for x in range(n):
    if n_line[x] in door_dict:
        if len(door_dict[n_line[x]]) > 1:
            door_dict[n_line[x]][1] = x
        else:
            door_dict[n_line[x]].append(x)
    else:
        door_dict[n_line[x]] = []
        door_dict[n_line[x]].append(x)

start_end = []
for key in door_dict:
    if door_dict[key][0] == door_dict[key][-1]:
        start_end.append([door_dict[key][0],'d'])
    else:
        start_end.append([door_dict[key][0],'s'])
        start_end.append([door_dict[key][-1],'f'])

max_conflicts = -1
conflicts = 0

sorted_vals = sorted(start_end)

for x in sorted_vals:
    if x[1] == 's':
        conflicts += 1
    elif x[1] == 'f':
        conflicts -=1
    elif x[1] == 'd':
        conflicts += 1

    if conflicts > max_conflicts:
        max_conflicts = conflicts
    if x[1] == 'd':
        conflicts -= 1

if k >= max_conflicts:
    print("NO")
else:
    print("YES")

from sys import maxsize, stdout, stdin,stderr
mod = int(1e9 + 7)
import re #can use multiple splits
def tup():return map(int,stdin.readline().split())
def I(): return int(stdin.readline())
def lint(): return [int(x) for x in stdin.readline().split()]
def S(): return input().strip()
def grid(r, c): return [lint() for i in range(r)]
def debug(*args, c=6): print('\033[3{}m'.format(c), *args, '\033[0m', file=stderr)
from  math import  log2,sqrt
from collections import defaultdict
# s= S().split()
# n = I()
#
# d='^>v<'
# if n%2==0:print('undefined')
# else:
#     st =d.find(s[0]).__index__()
#     en = d[(st+n)%4]
#     if en==s[1]:print('cw')
#     elif d[(st-n)%4]==s[1]:print('ccw')
#     else:print('undefined')
#
# #when k it is even it will end up in the same position so direction can't be determined
# #
# k = I()
# n =S()
# arr = sorted(list(map(int,n)))
# cnt =sum(arr)
# ans = 0
# #print(arr,cnt)
# for i in arr:
#     if  cnt < k:
#         cnt+=9 - i
#         ans+=1
# print(ans)
# #increasing sum by 9-d
from collections import deque
n,k = tup()
s =S()
c = k ; i =0; d = set()
di = defaultdict(int)
for i in s:
    di[i]+=1
c =k;gates = set()
d= deque()
i =0; f = 1
while i < n:
    if s[i] in gates:
        pass
    else:
        gates.add(s[i])
        if len(gates) >k:
            f =0
            break
    di[s[i]]-=1
    if di[s[i]]==0:
        gates.discard(s[i])
    i+=1
#op
if f==0:print("YES")
else:print("NO")

arr = list(map(int,input().split()))
total_g = arr[0]
guards = arr[1]
close_gate = dict()
entry = input()
changes = 0

for i in range(0,total_g):
    if entry[i] in close_gate:
        close_gate[entry[i]] = close_gate[entry[i]] + 1
    else:
       close_gate[entry[i]] =  1

cnt_gate = dict()
avg = guards
flag = 0

for i in range(0,total_g):
    # print(entry[i])
    if entry[i] not in cnt_gate:
        # print("new gate opened")
        cnt_gate[entry[i]] = 1
        avg = avg -1
        # print(cnt_gate[entry[i]],close_gate[entry[i]])
        # print('guards avl',avg)
        if cnt_gate[entry[i]] == close_gate[entry[i]]:
            avg = avg + 1
        if avg<1 and i!=0 and cnt_gate[entry[i-1]] != close_gate[entry[i-1]]:
            print('YES')
            flag = 1
            break
    else :
        cnt_gate[entry[i]] = cnt_gate[entry[i]] + 1
        if cnt_gate[entry[i]] == close_gate[entry[i]]:
            # print('gate was',entry[i], 'closed')
            avg = avg + 1

if flag == 0:
    print('N0')

n,k = map(int,raw_input().split())

fg = raw_input()

l = len(fg)

plave = {}

for index in xrange(l):
	try:
		plave[fg[index]].append(index)
	except KeyError:
		plave[fg[index]]=[index]

for p in plave:
	e = plave[p]
	c = True
	length = len(plave[p])
	for i in xrange(length-1):
		if e[i+1]-e[i]!=1:
			# print "no"
			c = False
			break
	if c==False:
		print "YES"
		break
if c==True:
	print "NO"

n,k = map(int, raw_input().split())
a = list(raw_input())
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

m = {}
given = {}
for i in alp:
	m[i] = -1
	given[i] = 0
for i in range(len(a)-1,-1,-1):
	if(m[a[i]]==-1):
		m[a[i]] = i
gates = 0
guards = k-1
given[a[0]] = 1

for i in range(1,len(a)):
	if(given[a[i]]):
		pass
	else:
		given[a[i]]=1
		guards-=1
	if(m[a[i]]==i):
		guards+=1
	if(guards<0):
		gates+=1
		break
if(gates==1):
	print "YES"
else:
	print "NO"

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

def rint():
    return 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 sl[s[i]][1] == i:
        cnt-=1
    if cnt > k:
        print("YES")
        exit()

print("NO")

from collections import Counter

def main():
    n, k = map(int, input().split())
    queue = input()

    counter = Counter()
    unique = list(set(queue))
    amount = dict(zip(unique, [queue.count(x) for x in unique]))

    for x in queue:
        if len(counter) > k:
            return 'Yes'

        counter[x] += 1
        if counter[x] == amount[x]:
            counter.pop(x)

    return 'NO'

print(main())

#RAVENS
#TEAM_2
#ESSI-DAYI_MOHSEN-LORENZO
#import sys
#input=sys.stdin.readline
n,k = map(int,input().split())
s = input()
close = dict()

for i in range(n-1,-1,-1):
    if close.get(s[i],-1) == -1:
        close[s[i]] = i

Open = 0
door = dict()
for i in range(n):
    if i == close[s[i]]:
        Open-=1
    else:
        if door.get(s[i],-1)==-1:
            Open+=1
            door[s[i]] = 1
    if Open > k:
        print('YES')
        exit()
print('NO')

n,k = [int(_) for _ in raw_input().strip().split()]
string = raw_input().strip()
dau = [1000010]*26
cuoi = [-1]*26
result = [0]*(n+100)
now =[]

for i in range(n):
  if string[i] not in now:
    now.append(string[i])
    position = ord(string[i])-ord('A')
    dau[position] = min(dau[position],i)
    cuoi[position] = max(cuoi[position],i)
for i in range(26):
  if cuoi[i] != -1:
    result[dau[i]] += 1
    result[cuoi[i]+1] -= 1
value = 0
for i in range(1,n):
  result[i] = result[i-1]+result[i]
  value = max(value,result[i])
if value > k:
  print "YES"
else:
  print "NO"# your code goes here

n,k = input().strip().split()
n=int(n)
k=int(k)
s=input()
m=[]
a=[]
if k>n or k==26:
    print('NO')
else:
    for i in range(n):
        l=s.find(s[i])
        p=s.rfind(s[i])
        if p not in m:
            m.append(p)
        if l not in a:
            a.append(l)
    #print(m)
    q=len(m)
    w=len(a)
    f=1
    for i in range (q):
        for j in range(i+1,w):
            if m[i]>a[j]:
                k-=1
    if k>0:
        print('NO')
    else:
        print('YES')

# Idea is to find first and last indices of all doors
# It will be time when door opens and time when door closes and guardian can leave

def main():
    opened = {}
    closed = {}

    n, k = map(int, input().split())
    seq = input()

    for i, way in enumerate(seq):
        if way not in opened:
            opened[way] = i
        else:
            closed[way] = i

    for i, way in enumerate(seq):
        if opened[way] == i:
            no_guardians = k == 0
            if no_guardians:
                print("YES")
                return
            else:
                k -= 1
        elif closed[way] != i:
            continue
        elif closed[way] == i:
            k += 1

    print("NO")
    return

main()

guests, guards = map(int, raw_input().split())

gates_opened = {}
count = {}

seq = raw_input()

for g in seq:
    c = count.setdefault(g, 0)
    count[g] = c+1

# print(count)
def main():
    gates = 0
    for g in seq:
        count[g] -= 1
        if gates_opened.has_key(g):
            if count[g] == 0:
                gates_opened.pop(g)
                gates -= 1
            continue
        # print(g, gates_opened)
        gates += 1
        gates_opened[g] = True
        if gates > guards:
            print('YES')
            return
    print('NO')

if __name__ == '__main__':
    main()

import string
n, k = map(int, input().split())
s = input()
board = dict(zip(string.ascii_uppercase, [[-1, -1] for _ in range(26)]))
# print(board)
s_set = set(s)
for c in s_set:
    board[c][0], board[c][1] = s.find(c), s.rfind(c)
# print(max([len(set(s[board[x][0]:board[x][1]])) for x in s_set]))
print('YES' if max([len(set(s[board[x][0]:board[x][1]])) for x in s_set]) <= k else 'NO')

n,k = map(int, input().split())
s = str(input())
f = [[0]*26for j in range(2)]
for i in range(26):
	aa = s.find(chr(65+i))
	bb = s.rfind(chr(65+i))
	f[0][i] = aa
	f[1][i] = bb
	#print(aa,bb,i)
	#print(f[0][i],f[1][i])
lmin = max(f[0])
#print(lmin)
ans = 0
for i in range(26):
	if f[1][i] > lmin:
		ans += 1
if ans <= k:
	print('NO')
else:
	print('YES')

import sys
n, k = map(int, input().split())
a = list(input())
st = [0] * 26
ed = [0] * 26
for i in range(n):
	if st[ord(a[i])-65] == 0:
		st[ord(a[i])-65] = i + 1
	else:
		ed[ord(a[i])-65] = i + 1
for i in range(26):
	if st[i] != 0 and ed[i] == 0:
		ed[i] = st[i]
n = 52
i = 1
j = 0
maxi = 1
l = 1
while i < 26 and j < 26:
	if st[i] == 0:
		i += 1
		continue
	if ed[j] == 0:
		j += 1
		continue
	if st[i] <= ed[j]:
		l += 1
		i += 1
		if l > maxi:
			maxi = l
	else:
		l -= 1
		j += 1
if maxi > k:
	print("YES")
else:
	print("NO")

X = list(map(int, input().split()))
Check = []
Entrance = input()
if X[0] == 1:
    print("NO")
    exit()
i = 1
Count = 0
while i < X[0]:
    if Entrance[i] != Entrance[i - 1]:
        if Entrance[i - 1] not in Check:
            Check.append(Entrance[i - 1])
        else:
            Count += 1
    i += 1
print("YES" if Count + 1 > X[1] else "NO")
# UB_CodeForces
# Advice: Falling down is an accident, staying down is a choice
# Location: Here in Bojnurd
# Caption: Preparing for UBCOMP4 and new starting
# CodeNumber: 612

n,k = map(int,input().split())
t = input()
k1 = set(t)
d = {}
for i in k1:
	d[i] = (t.index(i),n-t[::-1].index(i)-1)
s = set()
for i in range(len(t)):
	if i < d[t[i]][1]:
		s.add(t[i])
	if len(s) > k:
		print("YES")
		exit()
print("NO")

n,k=list(map(int,input().split()))
a=list(input())
p=0
b=a[::-1]
c=[]
available=k
for i in range(n-1):
    if a[i] in a[i+1:]:
        if a[i] not in c:
            c.append(a[i])
            available-=1
    elif a.count(a[i])==1:
        continue
    else:
        available+=1
    if available<0:
        p=1
        print("YES")
        break
if p==0:
    print("NO")

def get(a):return map(a,raw_input().split())
from collections import defaultdict
a,b = get(int)
hr = raw_input()
hs = set()
ls = defaultdict(int)
for i in xrange(len(hr)):
	ls[hr[i]] = i

for i in xrange(len(hr)):
	hs.add(hr[i])
	if ls[hr[i]] == i:
		hs.remove(hr[i])
	if len(hs) > b:
		print 'YES'
		exit(0)

print 'NO'

from math import inf,sqrt,floor,ceil
from collections import Counter,defaultdict,deque
from heapq import heappush as hpush,heappop as hpop,heapify as h
from operator import itemgetter
from itertools import product
from bisect import bisect_left,bisect_right

n,k=map(int,input().split( ))
s=input()
last=Counter()
for i in range(n):
    last[s[i]]=i
check=set()
check.add(s[0])
k-=1
ans="NO"
for i in range(n):
    if k<0:
        ans="YES"
        break
    if last[s[i]]==i and s[i] in check:
        k+=1
    else:
        if s[i] not in check:
            k-=1
            check.add(s[i])
print(ans)

def main ():
  n, k = [int(n) for n in input().split()]
  S = input();
  doors = {}

  for i, s in enumerate(S):
    doors[s] = i

  activeDoors = set();
  for i, s in enumerate(S):
    if doors[s] == i:
      if s in activeDoors:
        activeDoors.add(s);
        if(len(activeDoors) > k):
          return "YES"
        activeDoors.remove(s);
    else:
      activeDoors.add(s);
      if(len(activeDoors) > k):
          return "YES"

  return "NO"

print(main())

import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter

#sys.setrecursionlimit(100000000)

inp = lambda: int(input())
strng = lambda: input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda: list(input().strip())
mul = lambda: map(int, input().strip().split())
mulf = lambda: map(float, input().strip().split())
seq = lambda: list(map(int, input().strip().split()))

ceil = lambda x: int(x) if (x == int(x)) else int(x) + 1
ceildiv = lambda x, d: x // d if (x % d == 0) else x // d + 1

flush = lambda: stdout.flush()
stdstr = lambda: stdin.readline()
stdint = lambda: int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda: map(int, stdstr().split())

mod = 1000000007

n,k = stdarr()

s = input()
c = Counter(s)

c1 = c.copy()

opened = Counter()

flag = True

for i in s:
    c1[i] -= 1
    if(opened[i] == 0):
        if(k == 0):
            flag = False
            break
        else:
            k -= 1

        opened[i] = True
    else:
        if(c1[i] == 0):
            k += 1
        continue

if(not flag):
    print("YES")
else:
    print("NO")

# -*- coding: utf-8 -*-
"""
Created on Fri Sep 13 10:27:06 2019

@author: avina
"""

n,k = map(int, input().split())
st = input()
st2 = st[::-1]
t = False
for i in range(n):
    a = n - st2.index(st[i]) -1
    s = len(set(st[i:a]))
    if s > k:
        t = True
        break
if t:
    print('YES')
else:
    print('NO')

def fun():
    n,k=map(int,raw_input().split())
    gates=0
    mp={}
    opened={}
    inp=raw_input()
    for x in range(len(inp)):
        mp[inp[x]]=x
    for x in range(len(inp)):
        if mp[inp[x]]!=x:
            if inp[x] not in opened:
                opened[inp[x]]=1
                gates+=1
                if gates>k:
                    return "YES"
        else:
            gates-=1
    return "NO"
print fun()

n, k = map(int, input().split(' '))
inter = input(); d = {};
for i in range(26): d[chr(65+i)] = [-1, -1]

for i in range(len(inter)):
	if d[inter[i]][0] == -1: d[inter[i]][0] = i
	else: d[inter[i]][1] = i

def interect(a, b):
	return not(b[0] >= a[1] or b[1] <= a[0])
def getIntersection(a, b):
	return [max(a[0], b[0]), min(a[1], b[1])]

maxIntersections = 0
for i in range(26):
	inters, interval = 0, d[chr(65+i)]
	for j in range(26):
		if interect(interval, d[chr(65+j)]):
			inters += 1
			interval = getIntersection(interval, d[chr(65+j)])

	maxIntersections = max(maxIntersections, inters-1)

print("YES" if maxIntersections >= k else "NO")

arr = list(map(int,input().split()))
total_g = arr[0]
guards = arr[1]
close_gate = dict()
entry = input()
changes = 0

for i in range(0,total_g):
    if entry[i] in close_gate:
        close_gate[entry[i]] = close_gate[entry[i]] + 1
    else:
       close_gate[entry[i]] =  1
used_gates = len(close_gate)

cnt_gate = dict()
flag = 0
av_grds = guards
for i in range(0,total_g):
    if entry[i] not in cnt_gate:
        av_grds = av_grds - 1
        cnt_gate[entry[i]] = 1
        if cnt_gate[entry[i]] == close_gate[entry[i]]:
            av_grds = av_grds + 1
        if av_grds < 1:
            print("YES")
            flag = 1
            break
    else:
        cnt_gate[entry[i]] = cnt_gate[entry[i]] + 1
        if cnt_gate[entry[i]] == close_gate[entry[i]]:
            av_grds = av_grds + 1

if flag == 0:
    print("NO")

from collections import defaultdict
n,k=map(int,input().split())
s=input()
d=defaultdict(lambda:[-1,-1])
s1=s[::-1]
for x in range(65,91):
    if s.find(chr(x))!=-1:
        d[chr(x)][0]=s.find(chr(x))
        d[chr(x)][1]=(n-1)-s1.find(chr(x))
t=s[0]
k1=1
f=0
for x in range(1,n):
    if s[x]!=t and d[s[x-1]][1]!=x-1:
        k1+=1
        if k1>k:
            f=1
            break
    elif d[s[x-1]][1]==x-1:
        k1-=1
    t=s[x]
if f:
    print("YES")
else:
    print("NO")

#!/usr/bin/python3

def main():
    n, g = [int(x) for x in input().split()]
    data = input()
    dats = set(data)

    inicio = []
    final = []

    for val in dats:
        inicio.append(data.index(val))

        for end in range(n-1, 0, -1):
            if data[end] == val:
                final.append(end)
                break

    inicio.sort()
    final.sort()

    acima = len(inicio) > g
    total = 0
    i, f = 0, 0

    if acima:
        acima = False

        while (i < len(inicio)):
            if (inicio[i] <= final[f]):
                total += 1
                i += 1
            else:
                total -= 1
                f += 1

            if total > g:
                acima = True
                break

    print("YES" if acima else "NO")

if __name__ == "__main__": main()

n, k = [int (x) for x in raw_input().split()]
string = raw_input()
dau = []
cuoi = []
result = []

def prepare_data():
  for i in range(n):

    position = ord(string[i])-ord('A')
    if dau[position] == -1:
      dau[position] = i
    else:
      dau[position] = min(dau[position],i)
    cuoi[position] = max(cuoi[position],i+1)
  for i in range(26):
    if dau[i] != -1:
      result[dau[i]] += 1
      result[cuoi[i]] -= 1
  for i in range(n+1):
    if i > 0:
      result[i] = result[i-1]+result[i]
  return True

def load_data():

  for i in range(n+2):
    result.append(0)
  for i in range(26):
    dau.append(-1)
    cuoi.append(-1)
  return True

if __name__ == '__main__':
  load_data()
  print "ok"
  prepare_data()
  value = 0
  for i in range(n):
    if result[i] > k:
      value = 1
  if value == 1:
    print "YES"
  else:
    print "NO"# your code goes here

from collections import Counter
n, k = map(int, raw_input().split())
s = raw_input().strip()
sc = Counter(s)
tc = Counter()
ans = "NO"
for i in s:
  tc[i] += 1
  if tc[i] == sc[i]:
    del tc[i]
  if len(tc) > k:
    ans = "YES"
    break
print ans

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(b)
print(['NO', 'YES'][int(mb > k)])

n, k = input().split()
n = int(n)
k = int(k)

s = input()

open_doors = 0

opened = False
for i in range (len(s)):
    if opened == False:
        current = s[i]
        opened = True

    else:
        if s[i] != current:
            open_doors += 1
        else:
            opened = False

if open_doors >= k:
    print ("YES")

else:
    print ("NO")

n,k = map(int,raw_input().split())
unguarded = False

freq = {}
guests = raw_input()
for g in guests:
    if g not in freq:
        freq[g] = 1
    else:
        freq[g] += 1

op = 0
new = {}
for i in range(n):
    if guests[i] not in new:
        new[guests[i]] = 1
    else:
        new[guests[i]] += 1
    num = new[guests[i]]
    if num == 1:
        op += 1
    elif num == freq[guests[i]]:
        op -= 1

    if op > k:
        unguarded = True
        break

if unguarded:
    print "YES"
else:
    print "NO"

n, k = map(int, input().split())
doors = input()
close_i = {}
opened = set()
for c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
    close_i[c] = doors.rfind(c)
guards = 0
for i, d in enumerate(doors):
    if d not in opened:
        opened.add(d)
        guards += 1
        if guards > k:
            print("YES")
            break
    elif i == close_i[d]:
        guards -= 1
        opened.remove(d)
else:
    print("NO")

N,K=list(map(int,input().split()))
s=input()
dic={}
for i in range(len(s)):
    if(s[i] not in dic):
        dic[s[i]]=[i]
    else:
        dic[s[i]].append(i)
llist=[]
for i in dic.keys():
    r=[dic[i][0],dic[i][-1]]
    llist.append(r)
# llist=sorted(llist,key=lambda x:x[0])

countlist=[]
t=len(llist)
# i=0
for i in range(t):
    count=1
    end=llist[i][1]
    for j in range(i+1,t):
        start=llist[j][0]
        if(start<end):
            count+=1
    countlist.append(count)
# print(llist)
guard=max(countlist)
if(guard>K):
    print("YES")
else:
    print("NO")

n,k = [int(_) for _ in raw_input().strip().split()]
string = raw_input().strip()
dau = [1000010]*26
cuoi = [-1]*26
result = [0]*(n+2)
now =[]

for i in range(n):
  if string[i] not in now:
    now.append(string[i])
    position = ord(string[i])-ord('A')
    dau[position] = min(dau[position],i)
    cuoi[position] = max(cuoi[position],i+1)
for i in range(26):
  if cuoi[i] != -1:
    result[dau[i]] += 1
    result[cuoi[i]] -= 1
value = 0
for i in range(1,n):
  result[i] = result[i-1]+result[i]
  value = max(value,result[i])
if value > k:
  print "YES"
else:
  print "NO"# your code goes here

n,k=[int(i) for i in input().split()]
s=input().strip()
s=list(s)
l=[]
l1=[]
for i in range(26):
    l1.append(0)
    l.append(0)
for i in s:
    l[ord(i)-65]+=1
f=0
for i in s:
    l[ord(i)-65]-=1
    if (l[ord(i)-65]>0):
        l1[ord(i)-65]=1
    else:
        l1[ord(i)-65]=0
    if (l1.count(1)>k):
        print ('YES')
        f=1
        break
if (f==0):
    print ('NO')

n, k = map(int, input().split())
g = tuple(map(ord, input()))

e = [-1] * 91

for i in range(n):
    e[g[i]] = i
curS = 0
f = 1
met = [0] * 91
for i in range(n):
    if met[g[i]]:
        if i == e[g[i]]:
            curS -= 1
        continue
    curS += 1
    met[g[i]] = 1
    if curS > k:
        f = 0
        break

if f: print("NO")
else: print("YES")

def main(n, k, s):
    last = {}
    for i in range(n - 1, -1, -1):
        j = ord(s[i]) - ord('A')
        if j not in last:
            last[j] = i
    se = set()
    for i, c in enumerate(list(map(lambda i: ord(i) - ord('A'), s))):
        if c not in se:
            se.add(c)
        if i == last[c]:
            se.remove(c)
        if len(se) > k:
            return "YES"
    return "NO"

print(main(*list(map(int, input().split(' '))), input()))

m,n = map(int,raw_input().split())
a = []
s = raw_input()
ml = 0
for i in range(m):
	if s[i] not in a:
		a.append(s[i])
		if ml < len(a):
			ml = len(a)
	else:
		a = []
if ml > n :
	print("YES")
else:
	print("NO")

import sys
n, k = map(int, input().split())
a = list(input())
st = [0] * 26
ed = [0] * 26
for i in range(n):
	if st[ord(a[i])-65] == 0:
		st[ord(a[i])-65] = i + 1
	else:
		ed[ord(a[i])-65] = i + 1
for i in range(26):
	if st[i] != 0 and ed[i] == 0:
		ed[i] = st[i]
n = 52
i = 0
j = 0
maxi = -1 * sys.maxsize
l = 0
while i < 26 and j < 26:
	if st[i] == 0:
		i += 1
		continue
	if ed[j] == 0:
		j += 1
		continue
	if st[i] <= ed[j]:
		l += 1
		i += 1
		if l > maxi:
			maxi = l
	else:
		l -= 1
		j += 1
if maxi > k:
	print("YES")
else:
	print("NO")

import sys
n,k=map(int,input().split())
s=input()
start={}
close={}
for i in range(n):
    kk=s[i]
    try:
        a=start[kk]
        close[kk]=i
    except KeyError:
        start[kk]=i
        close[kk]=i
ac=0
for i in range(n):
    kk=s[i]
    if(start[kk]==i):
        ac+=1
        if(ac>k):
            print("YES")
            sys.exit(0)
    elif(close[kk]==i):
        ac-=1
    if(ac>k):
        print("YES")
        sys.exit(0)
print("NO")

n, k = map(int, input().split())
g = tuple(map(ord, input()))

e = [-1] * 91

for i in range(n):
    e[g[i]] = i
curS = 0
f = True
met = [False] * 91
for i in range(n):
    if met[g[i]]:
        if i == e[g[i]]:
            curS -= 1
        continue
    if i == e[g[i]]:
        continue
    curS += 1
    met[g[i]] = True
    if curS > k:
        f = False
        break

if f: print("NO")
else: print("YES")

X = list(map(int, input().split()))
Entrance = input()
MyDict = {}
for i in range(X[0]):
    if Entrance[i] not in MyDict.keys():
        MyDict[Entrance[i]] = []
    MyDict[Entrance[i]].append(i)
Count = 0
for i in MyDict.keys():
    if MyDict[i][-1] - MyDict[i][0] + 1 != len(MyDict[i]):
        Count += 1
print("YES" if Count + 1 > X[1] else "NO")

# UB_CodeForces
# Advice: Falling down is an accident, staying down is a choice
# Location: Here in Bojnurd
# Caption: Preparing for UBCOMP4 and new starting
# CodeNumber: 612

n,k = input().strip().split()
n=int(n)
k=int(k)
s=input()
m=[]
a=[]
if k>n or k==26:
    print('NO')
else:
    for i in range(n):
        l=s.find(s[i])
        p=s.rfind(s[i])
        if p not in m:
            m.append(p)
        if l not in a:
            a.append(l)
    #print(m)
    q=len(m)
    w=len(a)
    f=1
    for i in range (q):
        for j in range(i+1,w):
            if m[i]>a[j]:
                k-=1
    if k>0:
        print('NO')
    else:
        print('YES')

n,k=map(int,raw_input().split())
alpha=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
max_dict={}
for i in alpha:
    max_dict[i]=0
guests=list(raw_input())
for i in guests:
    max_dict[i]+=1
guarded={}
for i in alpha:
    guarded[i]=0
current_dict={}
for i in alpha:
    current_dict[i]=0
is_true=True

for guest in guests:

    if current_dict[guest]==0:
        current_dict[guest]+=1
        guarded[guest]=1

    if sum(guarded.values())>k:
        is_true=False
        print 'NO'
        break

    if current_dict[guest]==max_dict[guest]:
        guarded[guest]=0

if is_true==True:
    print 'YES'

n,k=map(int,input().split())
s=input()
mx=dict()
for x in range(n):
    mx[s[x]]=x
cur=0
ans=0
c={x.upper():0 for x in 'qwertyuiopasdfghjklzxcvbnm'}
for x in range(n):
    if c[s[x]]==0:
        cur+=1
        c[s[x]]=1
    if mx[s[x]]==x:
        cur-=1
        c[s[x]]=0
    if cur > k:
        ans=1
    #print(cur,x,s[x])
print('NO' if not ans else 'YES')

from collections import deque
from math import *
import heapq

# n=int(input())
n,k=map(int, input().split())
s=input()
d={}
e={}
for i in range(len(s)):
    d[s[i]]=i
    e[s[i]]=0

counter=0
for j in range(len(s)):
    if d[s[j]]!=j and e[s[j]]==0:
        e[s[j]]=1
        counter+=1
    elif d[s[j]]==j and e[s[j]]==1:
        counter-=1

    if counter>k:
        print("YES")
        exit()
print("NO")

from collections import *
n,k=map(int,input().split())
s=input()
a=Counter(s)
x,c=0,0
cnt={}
for i in s:
	if i in cnt:cnt[i]+=1
	else:cnt[i]=1;c+=1
	if cnt[i]==a[i]:c-=1
	x=max(x,c)
print("YES"if x>k else"NO")

n, k = map(int, input().split())
g = tuple(map(ord, input()))

e = [-1] * 91

for i in range(n):
    e[g[i]] = i
curS = 0
f = 1
met = [0] * 91
for i in range(n):
    if met[g[i]]: continue
    curS += 1
    met[g[i]] = 1
    if curS > k:
        f = 0
        break
    if i == e[g[i]]:
        curS -= 1

if f: print("NO")
else: print("YES")

n,k = input().strip().split()
n=int(n)
k=int(k)
s=input()
m=[]
a=[]
if k>n or k==26:
    print('NO')
else:
    for i in range(n):
        l=s.find(s[i])
        p=s.rfind(s[i])
        if p not in m:
            m.append(p)
        if l not in a:
            a.append(l)
    #print(m)
    q=len(m)
    w=len(a)
    f=1
    for i in range (q):
        for j in range(i+1,w):
            if m[i]>a[j]:
                k-=1
                break
    #print(k)
    if k>0:
        print('NO')
    else:
        print('YES')

n, k = map(int, input().split())
s = input()
arr = dict()
arr_ = dict()
ans = 'NO'
for i in range(65, 91):
    arr[chr(i)] = 0
    arr_[chr(i)] = 0
for i in s:
    arr_[i] += 1
for i in s:
    if arr[i] == 0:
        k -= 1
    arr[i] += 1
    if arr[i] == arr_[i]:
        k += 1
    if k < 0:
        ans = 'YES'
print(ans)

n, ka = [int(x) for x in raw_input().split()]
# print k+"ll"
gates = raw_input()
open = dict()
close = dict()
count = 0
for k in gates:
	if k not in open:
		open[k] = count
	close[k] = count
	count += 1
arr = [0 for x in xrange(1000006)]
for key in open:
	arr[open[key]] += 1
for key in close:
	arr[close[key]] -= 1
# print arr[0:n+1]
count = 0
for i in arr:
	count += i
	# print count - ka
	if(count > ka):
		print "YES"
		exit()
print "NO"

N,K=list(map(int,input().split()))
s=input()
dic={}
for i in range(len(s)):
    if(s[i] not in dic):
        dic[s[i]]=[i]
    else:
        dic[s[i]].append(i)
llist=[]
for i in dic.keys():
    r=[dic[i][0],dic[i][-1]]
    llist.append(r)
# llist=sorted(llist,key=lambda x:x[0])

countlist=[]
t=len(llist)
# i=0
for i in range(t):
    count=1
    temp=0
    end=llist[i][1]
    for j in range(i+1,t):
        start=llist[j][0]
        if(start<end):
            if(llist[j][1]<end and temp==0):
                count+=1
                temp=1
            elif(llist[j][1]>end):
                count+=1
    countlist.append(count)
# print(llist)
print(countlist)
guard=max(countlist)
if(guard>K):
    print("YES")
else:
    print("NO")

n, k = map(int, input().split())
g = input()

curS = 0
f = 1
met = [0] * 26
for i in range(n):
    if not met[ord(g[i]) - 65]:
        curS += 1
        met[ord(g[i]) - 65] = 1
    else:
        curS -= 1
        met[ord(g[i]) - 65] = 0
    if curS > k:
        f = 0
        break

if f: print("NO")
else: print("YES")

def read(is_int,split_by):
	if(is_int):
		return [int(x) for x in input().split(split_by)]
	else:
		return [x for x in input().split(split_by)]
n, k = map(int,input().split(" "))
s = input()
answer = "NO"
high = {}
low = {}
interset = {}
if k == 26:
	answer = "NO"
else:
	for i in range(n):
		if not (s[i] in low):
			low[s[i]] = i
		high[s[i]] = i
	for f_key in high:
		max_intersect = 0
		for s_key in high:
			if f_key == s_key:
				continue
			else:
				if high[f_key] > low[s_key] and low[f_key] < high[s_key]:
					if not(f_key in interset):
						interset[f_key] = set()
						interset[f_key].add(s_key)
					else:
						interset[f_key].add(s_key)
	all_intersect = []
	all_key = []
	for key in interset:
		all_intersect.append(len(interset[key]))
		all_key.append(key)
	if(all_intersect):
		max_elem = max(all_intersect)
		index_max = all_intersect.index(max_elem)
		key = all_key[index_max]

		for f_elem in interset[key]:
			for s_elem in interset[key]:
				if f_elem == s_elem:
					continue
				else:
					if interset[f_elem].isdisjoint(interset[s_elem]):
						max_elem-=1
						interset[key].remove(s_elem)
						break
	else:
		max_elem = 0
if max_elem+1 > k:
	answer = "YES"
else:
	answer = "NO"
print(answer)

n,k=map(int,input().split())
list1=input()
s=set([])
f=0
for i in range(n):
    if(list1[i] in s):
        if(list1.find(list1[i],i+1)==-1):
            s.remove(list1[i])
    else:
        s.add(list1[i])
    if(len(s)>k):
        f=1
if(f==1):
    print("YES")
else:
    print("NO")

from math import inf,sqrt,floor,ceil
from collections import Counter,defaultdict,deque
from heapq import heappush as hpush,heappop as hpop,heapify as h
from operator import itemgetter
from itertools import product
from bisect import bisect_left,bisect_right

n,k=map(int,input().split( ))
s=input()
last=Counter()
for i in range(n):
    last[s[i]]=i
check=set()
check.add(s[0])
k-=1
ans="NO"
for i in range(n):
    if k<0:
        ans="YES"
        break
    if last[s[i]]==i:
        k+=1
    else:
        if s[i] not in check:
            k-=1
            check.add(s[i])
print(ans)

def diff(a):
	return(a[1]-a[0]+1)

n,k=map(int,str(raw_input()).split())
A=str(raw_input())
d=[0]*26
for i in xrange(len(A)):
	if d[ord(A[i])-ord('A')] == 0:d[ord(A[i])-ord('A')]=[i,i]
	else:d[ord(A[i])-ord('A')]=[d[ord(A[i])-ord('A')][0],i]
d = map(diff,sorted([x for x in d if x != 0]))
if len(d)<=k:print 'NO'
else:
	if sum(d)<=n:print 'NO'
	else:print 'YES'

m,n = map(int,raw_input().split())
a = []
s = raw_input()
ml = 0
for i in range(m):
	if s[i] not in a:
		a.append(s[i])
		if ml < len(a):
			ml = len(a)
	else:
		a = []
if ml > n :
	print("YES")
else:
	print("NO")

n, m = raw_input().split()
entrada = raw_input()
m = int(m)
mapa = {}
c = True
for e in entrada:
	if mapa.has_key(e):
		mapa[e][0] += 1

	else:
		mapa[e] = [1, False]

for e in entrada:
	if not mapa[e][1]:
		m -= 1
		mapa[e][0] -= 1
		if mapa[e][0] == 0:
			m += 1
			mapa[e][1] = False
		mapa[e][1] = True

	else:
		mapa[e][0] -= 1
		if mapa[e][0] == 0:
			m += 1
			mapa[e][1] = False

	if m < 0:
		print "NO"
		c = False
		break

if c: print "YES"

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

a = [None] * n
d = {}

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

d.clear()
for i in range(n - 1, -1, -1):
    if s[i] not in d:
        a[i] = False
        d[s[i]] = True

c = 0
for el in a:
    if el is not None and el:
        c += 1
    if el is not None and not el:
        c -= 1
    if c > k:
        print('YES')
        exit()
print('NO')

n,k = 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

for i in data:
    if i not in d:
        count+=1
        m = max(m, count)
        d[i]=1
    else:
        d[i]+=1
        if d[i]== c[i]:
            del d[i]
            count-=1
if m<=k :
    print('NO')
else:
    print('YES')

import heapq

def doIt(s):
    for c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
        if c in s:
            a,b = s.rfind(c), s.find(c)
            if a != b:
                heapq.heappush(end, a)
                heapq.heappush(start, b)

    current = 0
    while start:
        if start[0] < end[0]:
            heapq.heappop(start)
            current += 1

            if current > k:
                return "YES"
        else:
            heapq.heappop(end)
            current -= 1
    return "NO"

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

start = []
end = []

print(doIt(s))

from collections import Counter

if __name__ == '__main__':
    n, k = list(map(int, input().split()))
    q = input()

    guest_counts = Counter(q)
    is_door_open = {
        g: False for g in guest_counts
    }
    opened_doors = 0

    for g in q:
        if guest_counts[g] == 1:
            is_door_open[g] = False
            opened_doors -= 1
            del guest_counts[g]
        else:
            guest_counts[g] -= 1
            if not is_door_open[g]:
                is_door_open[g] = True
                opened_doors += 1
            if opened_doors > k:
                print('YES')
                exit(0)
    print('NO')

n, k = map(int, raw_input().split())
s = raw_input()
flag = [False]*26
from collections import Counter as C
c = C()
for i in s:
    c[i]+=1
f = False
ans = 0
for i in range(len(s)):
    if flag[ord(s[i])-65]==False:
        flag[ord(s[i])-65] = True
        ans += 1
    c[s[i]]-=1
    if c[s[i]]==0:
        ans-=1
    if ans>k:
        f = True
        break
if f:
    print "YES"
else:
    print "NO"

n,k=map(int, raw_input().split())
s=raw_input()
l=[[-1,-1] for i in xrange(26)]
for i in xrange(len(s)):
	if l[ord(s[i])-65][0]==-1:
		l[ord(s[i])-65][0]=i
		l[ord(s[i])-65][1]=i
	else:
		l[ord(s[i])-65][1]=i
p=[]
q=[]
for i in l:
	if i[0]!=-1:
		p.append(i[0])
		q.append(i[1])
p=sorted(p)
q=sorted(q)
#print p,q
cnt=0
i=0
j=0
c=0
while i<len(p):

	if p[i]<q[j]:
#		print p[i],q[j]
		c+=1
		i+=1
	elif p[i]>q[j]:
		c-=1
		j+=1
	else:
		i+=1
		j+=1
#	print p[i]
#	print i,j,p[i],q[j]
	cnt=max(cnt,c)

#for i in xrange(len(l)):
#	c=1
#	for j in xrange(len(l)):
#		if i!=j and (l[i][0]<l[j][0]<l[i][1] or l[i][0]<l[j][1]<l[i][1]):
#			c+=1
#	cnt=max(cnt,c)
if cnt>k:print 'YES'
else:print 'NO'

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import string
import sys

def main():
    iterator = iter(sys.stdin.read().split())
    n, m = int(next(iterator)), int(next(iterator))
    s = next(iterator)
    p = {}
    buffer = set()
    for i in string.ascii_uppercase:
        p[i] = s.rfind(i)
    for i, x in enumerate(s):
        if i < p[x]:
            buffer.add(x)
            if len(buffer) > m:
                print('YES')
                return
        elif x in buffer:
            buffer.remove(x)
    print('NO')

if __name__ == '__main__':
    main()

def main(n, k, s):
    last = {}
    for i in range(n - 1, -1, -1):
        j = ord(s[i]) - ord('A')
        if j not in last:
            last[j] = i
    se = set()
    for i, c in enumerate(list(map(lambda i: ord(i) - ord('A'), s))):
        if c not in se:
            se.add(c)
        if i == last[c]:
            se.remove(c)
        if len(se) > k:
            return "YES"
    return "NO"

print(main(*list(map(int, input().split(' '))), input()))

m,n = map(int,raw_input().split())
a = []
positions = {}
s = raw_input()
ml = 0
for i in range(m):
	if s[i] not in a:
		a.append(s[i])
		positions[s[i]]=[i,i]
	else:
		positions[s[i]] = [positions[s[i]][0],i]
a = []
assing_gard = 0
max_a = 0
for i in range(m-1):
	if s[i] not in a:
		assing_gard += 1
		if assing_gard > max_a:
			max_a = assing_gard
		a.append(s[i])
	elif positions[s[i]][1] == i:
		assing_gard -= 1

if max_a > n:
	print("YES")
else:
	print("NO")

n,k = input().strip().split()
n=int(n)
k=int(k)
s=input()
m=[]
a=[]
if k>n or k==26:
    print('NO')
else:
    for i in range(n):
        l=s.find(s[i])
        p=s.rfind(s[i])
        if p not in m:
            m.append(p)
        if l not in a:
            a.append(l)
    #print(m)
    q=len(m)
    w=len(a)
    f=1
    for i in range (q):
        for j in range(i+1,w):
            if m[i]>a[j]:
                k-=1
    if k>0:
        print('NO')
    else:
        print('YES')

n, ka = [int(x) for x in raw_input().split()]
# print k+"ll"
gates = raw_input()
open = dict()
close = dict()
count = 0
for k in gates:
	if k not in open:
		open[k] = count
	close[k] = count
	count += 1
arr = [0 for x in xrange(1000006)]
for key in open:
	arr[open[key]] += 1
for key in close:
	arr[close[key]] -= 1
# print arr[0:n+1]
count = 0
for i in arr:
	count += i
	# print count - ka
	if(count > ka):
		print "YES"
		exit()
print "NO"

n,k=map(int,input().split())
x=list(input().split())
a=set(x[0])

z=[]
if(len(a)<=k):
    print("NO")
else:
    for j in range(n-1):
        if(x[0][j]==x[0][j+1]):
            continue
        else:
            z.append(x[0][j])
    if(len(z)!=k):
        print("YES")
    else:
        print("NO")

n, k = map(int, input().split())
s = input()
arr = dict()
arr_ = dict()
ans = 'NO'
for i in range(65, 91):
    arr[chr(i)] = 0
    arr_[chr(i)] = 0
for i in s:
    arr_[i] += 1
for i in s:
    if arr[i] == 0:
        k -= 1
    arr[i] += 1
    if arr[i] == arr_[i]:
        k += 1
    if k < 0:
        ans = 'YES'
print(ans)

n,k=map(int,input().split())
x=list(input().split())
a=set(x[0])

z=[]
if(len(a)<=k):
    print("NO")
else:
    for j in range(n-1):
        if(x[0][j]==x[0][j+1]):
            continue
        else:
            z.append(x[0][j])
    z.append(x[0][n-1])
    if(len(z)!=len(a)):
        print("YES")
    else:
        print("NO")

n, m = raw_input().split()
entrada = raw_input()
m = int(m)
mapa = {}
c = True
for e in entrada:
	if mapa.has_key(e):
		mapa[e][0] += 1

	else:
		mapa[e] = [1, False]

for e in entrada:
	if not mapa[e][1]:
		m -= 1
		mapa[e][0] -= 1
		if mapa[e][0] == 0:
			m += 1
			mapa[e][1] = False
		mapa[e][1] = True

	else:
		mapa[e][0] -= 1
		if mapa[e][0] == 0:
			m += 1
			mapa[e][1] = False

	if m < 0:
		print "NO"
		c = False
		break

if c: print "YES"

n,k=map(int,input().split())
list1=input()
s=set([])
f=0
for i in range(n):
    if(list1[i] in s):
        if(list1.find(list1[i],i+1)==-1):
            s.remove(list1[i])
    else:
        s.add(list1[i])
    if(len(s)>k):
        f=1
if(f==1):
    print("YES")
else:
    print("NO")

n, k = map(int, input().split())
s = input()
d1 = {}
d2 = {}
for i, v in enumerate(s):
  if v not in d1: d1[v] = i
  d2[v] = i
order = []
for v in d1:
  order.append((d1[v], 1))
  order.append((d2[v], -1))
order.sort()

cur = 0
for _, v in order:
  cur += v
  if cur > k:
    print("YES")
    break
else:
  print("NO")

n,r=map(int,input().split())
s=list(input().split())
x=[s[0][0]]
count=1
z=s[0][0]
for j in range(1,n):
    if(s[0][j]!=z):
        if(s[0][j] not in x):
            x.append(s[0][j])
            z=s[0][j]
        else:
            count+=1
if(count<=r):
    print("NO")
else:
    print("YES")

n, k = map(int, input().split())
s = input()
l = {}
for e in s:
  l[e] = n - 1 - s[::-1].index(e)
g = []
for x in range(n):
  if s[x] in g:
    if x == l[s[x]]:
      k += 1
      g.remove(s[x])
  else:
    g.append(s[x])
    k -= 1
    if k < 0:
      print("YES")
      break
else:
  print("NO")

import sys

def solve(n, k, letters):
    start_positions = {}
    end_positions = {}
    for idx, letter in enumerate(letters):
        if letter not in start_positions:
            start_positions[letter] = idx
            end_positions[letter] = idx + 1
        else:
            end_positions[letter] = idx + 1

    inv_end_positions = {}
    inv_start_positions = {}
    for position in start_positions:
        if start_positions[position] in inv_start_positions:
            inv_start_positions[start_positions[position]] += 1
        else:
            inv_start_positions[start_positions[position]] = 1

    for position in end_positions:
        if end_positions[position] in inv_end_positions:
            inv_end_positions[end_positions[position]] += 1
        else:
            inv_end_positions[end_positions[position]] = 1

    num_open = 0
    for l in range(10**6+1):
        if l in inv_end_positions:
            num_open -= inv_end_positions[l]
        if num_open > k:
            return "YES"
        if l in inv_start_positions:
            num_open += inv_start_positions[l]
    return "NO"

if __name__ == "__main__":
    n, k = map(int, sys.stdin.readline().split())
    letters = list(sys.stdin.readline().strip())
    print solve(n, k, letters)

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

def rint():
    return 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
    elif sl[s[i]][1] == i:
        cnt-=1
    if cnt > k:
        print("YES")
        exit()

print("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])
  else:
    g.add(s[x])
    k -= 1
    if k < 0:
      print("YES")
      quit()
print("YES" if k < 0 else "NO")

#RAVENS
#TEAM_2
#ESSI-DAYI_MOHSEN-LORENZO
#import sys
#input=sys.stdin.readline
n,k = map(int,input().split())
s = input()
close = dict()

for i in range(n-1,-1,-1):
    if close.get(s[i],-1) == -1:
        close[s[i]] = i

Open = 0
door = dict()
for i in range(n):
    if i == close[s[i]]:
        Open-=1
    else:
        if door.get(s[i],-1)==-1:
            Open+=1
            door[s[i]] = 1
    if Open > k:
        print('YES')
        exit()
print('NO')

n, k = map(int, input().split())
g = tuple(map(ord, input()))

e = [-1] * 91

for i in range(n):
    e[g[i]] = i
curS = 0
f = 1
met = [0] * 91
for i in range(n):
    if met[g[i]]: continue
    curS += 1
    met[g[i]] = 1
    if curS > k:
        f = 0
        break
    if i == e[g[i]]:
        curS -= 1

if f: print("NO")
else: print("YES")