using System;

namespace CodeForces.Archieve
{
    public static class Program
    {
        public static void Main(string[] args)
        {
            int n = 0, k = 0;
            string[] input = Console.ReadLine().Split(' ');

            n = int.Parse(input[0]);
            k = int.Parse(input[1]);

            string str = Console.ReadLine();

            int[] first = new int[26];
            int[] last = new int[26];
            for (int i = 0; i < 26; ++i)
            {
                first[i] = int.MaxValue;
                last[i] = -1;
            }
            for (int i = 0; i < str.Length; ++i)
            {
                int crt = str[i] - 'A';
                if (i < first[crt])
                {
                    first[crt] = i;
                }
                if (i > last[crt])
                {
                    last[crt] = i;
                }
            }

            bool ans = true;
            int cnt = 0;
            for (int i = 0; i < str.Length; ++i)
            {
                int crt = str[i] - 'A';
                if (i == first[crt])
                {
                    ++cnt;
                }

                if (cnt > k)
                {
                    ans = false;
                    break;
                }

                if (i == last[crt])
                {
                    --cnt;
                }
            }

            if (ans)
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
            }
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;

namespace Coding
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = x[0];
            var k = x[1];

            var s = Console.ReadLine();

            var cnt = 0;
            var fst = new int[26];
            var lst = new int[26];

            for (int i = 0; i < 26; i++)
            {
                fst[i] = -1;
                lst[i] = -1;
            }

            for (int i = 0; i < s.Length; i++)
            {
                var c = (int)(s[i] - 'A');

                if (fst[c] == -1)
                {
                    fst[c] = i;
                }

                lst[c] = i;
            }

            for (int i = 0; i < s.Length; i++)
            {
                var c = (int)(s[i] - 'A');
                if (fst[c] == i)
                {
                    cnt++;
                }

                if (cnt > k)
                {
                    Console.WriteLine("YES");
                    return;
                }

                if (lst[c] == i)
                {
                    cnt--;
                }
            }

            Console.WriteLine("NO");
        }
    }
}

using System;
using System.Collections.Generic;

namespace CodeForces
{
    static class Program
    {
        static void Main()
        {
            const string filePath = @"Data\R426B.txt";
            if (System.IO.File.Exists(filePath))
            {
                Console.SetIn(new System.IO.StreamReader(filePath));
            }

            IProblem counter = new R426B();

            foreach (var result in counter.GetResults())
            {
                Console.WriteLine(result);
            }
        }
    }

    internal class R426B : ProblemBase
    {
        private class Info
        {
            public int Start { get; set; }
            public int Finish { get; set; }
        }

        public override IEnumerable<string> GetResults()
        {
            var usage = new Dictionary<char, Info>();
            var ints = this.ReadIntArray();
            var n = ints[0];
            var k = ints[1];

            var line = Console.ReadLine();
            for (int i = 0; i < line.Length; i++)
            {
                var current = line[i];
                if (!usage.ContainsKey(current))
                {
                    usage.Add(current, new Info { Start = i });
                }
                usage[current].Finish = i;
            }

            var problemFound = false;
            foreach (var candidate in usage.Keys)
            {
                var t = usage[candidate].Start;
                var total = 0;
                foreach (var key in usage.Keys)
                {
                    if (usage[key].Start <= t && usage[key].Finish >= t)
                    {
                        total++;
                    }
                }

                if (total > k)
                {
                    problemFound = true;
                    break;
                }
            }

            yield return problemFound ? "YES" : "NO";
        }
    }

    abstract class MultipleTestsBase : ProblemBase
    {
        public sealed override IEnumerable<string> GetResults()
        {
            var t = Convert.ToInt32(Console.ReadLine());
            for (int testCaseNumber = 0; testCaseNumber < t; testCaseNumber++)
            {
                foreach (var result in this.GetTestResult(testCaseNumber + 1))
                {
                    yield return result;
                }

            }

        }

        protected abstract IEnumerable<string> GetTestResult(int caseNumber);
    }

    public interface IProblem
    {
        IEnumerable<string> GetResults();
    }

    public abstract class ProblemBase : IProblem
    {
        /// <summary>
        /// Pring array of T
        /// </summary>
        /// <typeparam name="T">Generic paramter.</typeparam>
        /// <param name="items">The items.</param>
        /// <param name="prefixMessage">The message shown first.</param>
        public void PrintArray<T>(IEnumerable<T> items, string prefixMessage)
        {
            Console.WriteLine("{0}: {1}", prefixMessage, string.Join(",", items));
        }

        public void WriteDiagnostics(string message, params object[] objects)
        {
            Console.WriteLine(message, objects);
        }

        public virtual IEnumerable<string> GetResults()
        {
            yield return "No result";
        }

        protected int[] ReadIntArray()
        {
            return Array.ConvertAll(ReadTokens(), Convert.ToInt32);
        }

        protected string[] ReadTokens()
        {
            var readLine = Console.ReadLine();
            if (readLine == null)
            {
                throw new Exception("Value read from Console is null");
            }
            return readLine.Split(' ');
        }

        protected int ReadInt32()
        {
            return Convert.ToInt32(Console.ReadLine());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace _834
{
    class Program
    {
        static void Main(string[] args)
        {
            B();
            Console.WriteLine();
        }

        private static void B()
        {
            var s = Console.ReadLine();
            var sp = s.Split(' ');
            var n = sp[0];
            var k = int.Parse(sp[1]);
            var s1 = Console.ReadLine();
            var m = new Dictionary<char, Tuple<int, int>>();

            for (char i = 'A'; i < 91; i++)
            {
                var f = s1.IndexOf(i);
                var l = s1.LastIndexOf(i);
                if (f > -1)
                {
                    m.Add(i, new Tuple<int, int>(f, l));
                }
            }

            int g = 0;
            for (int i = 0; i < s1.Length; i++)
            {
                var nn = m.Count(u => u.Value.Item1 <= i && u.Value.Item2 >= i);
                if (nn > k)
                {
                    Console.Write("YES");
                    return;
                }
            }
            Console.Write("NO");
        }

        private static void A()
        {
            var s = Console.ReadLine();
            var sp = s.Split(' ');
            var first = sp[0];
            var second = sp[1];
            var f1 = 0;
            var f2 = 0;
            switch (first)
            {
                case "^": f1 = 0; break;
                case ">": f1 = 1; break;
                case "v": f1 = 2; break;
                case "<": f1 = 3; break;
            }
            switch (second)
            {
                case "^": f2 = 0; break;
                case ">": f2 = 1; break;
                case "v": f2 = 2; break;
                case "<": f2 = 3; break;
            }
            var he = int.Parse(Console.ReadLine());
            he = he % 4;
            if ((f1 - f2) % 2 == 0)
            {
                Console.Write("undefined");
                return;
            }
            if ((f1 + he) % 4 == f2)
            {
                Console.Write("cw");
            }
            else
            {
                Console.Write("ccw");
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TorzestevennijVe4er
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int k = int.Parse(s[1]);

            string guests = Console.ReadLine();

            Dictionary<char, int> last = new Dictionary<char, int>();
            Dictionary<char, int> first = new Dictionary<char, int>();

            for (int i=0;i<n;i++)
            {
                if (!last.ContainsKey(guests[i]))
                    last.Add(guests[i], i);
                else
                    last[guests[i]] = i;

                if (!first.ContainsKey(guests[i]))
                    first.Add(guests[i], i);
            }

            int open = 0;
            bool ans = false;

            for (int i=0;i<n;i++)
            {
                if (first[guests[i]] == i) open++;

                if (open>k)
                {
                    ans = true;
                    break;
                }

                if (last[guests[i]] == i) open--;
            }

            if (ans)
                Console.Write("YES");
            else
                Console.Write("NO");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int n = input[0];
            int k = input[1];
            string str = Console.ReadLine();

            if (k == 26)
            {
                Console.WriteLine("NO");
                return;
            }
            var lastPositions = new Dictionary<char, int>();
            int openGatesCount = 0;
            for (int i = 0; i < n; i++)
            {
                int lastPosition;
                char gate = str[i];
                if (!lastPositions.ContainsKey(gate))
                {
                    openGatesCount++;
                    if (openGatesCount > k)
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                    lastPosition = str.LastIndexOf(gate);
                    lastPositions.Add(gate, lastPosition);
                }
                else
                {
                    lastPosition = lastPositions[gate];
                }
                if (lastPosition == i)
                {
                    openGatesCount--;
                }
            }
            Console.WriteLine("NO");
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace The_Festive_Evening
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();
            int k = Next();

            var nn = new int[n];
            for (int i = 0; i < n; i++)
            {
                nn[i] = Next();
            }

            var close = new int['Z' - 'A' + 1];
            for (int i = 0; i < n; i++)
            {
                close[nn[i]] = i;
            }

            int opened = 0;
            int maxopened = 0;
            var f = new bool[close.Length];
            for (int i = 0; i < n; i++)
            {
                if (!f[nn[i]])
                {
                    opened++;
                    f[nn[i]] = true;
                }

                maxopened = Math.Max(maxopened, opened);

                if (close[nn[i]] == i)
                {
                    opened--;
                }
            }

            writer.WriteLine(maxopened > k ? "Yes" : "No");
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c >= 'A' && c <= 'Z')
                    return c - 'A';
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Linq;

namespace WithConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = input[0];
            var k = input[1];
            var s = Console.ReadLine();

            var guestsByDoor = new int[26];
            var doorWasOpened = new bool[26];

            for (var i = 0; i < s.Length; ++i)
            {
                int door = s[i] - 'A';
                ++guestsByDoor[door];
            }

            bool @unsafe = false;
            for (var i = 0; i < s.Length; ++i)
            {
                int door = s[i] - 'A';
                if (!doorWasOpened[door])
                {
                    if (k == 0)
                    {
                        @unsafe = true;
                        break;
                    }
                    else
                    {
                        --k;
                        doorWasOpened[door] = true;
                    }
                }
                --guestsByDoor[door];
                if (guestsByDoor[door] == 0)
                {
                    ++k;
                }
            }
            Console.WriteLine(@unsafe ? "YES" : "NO");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp54
{
    class Program
    {
        static void Main(string[] args)
        {
            //64
            int[] inp0 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = inp0[0];
            int k = inp0[1];
            char[] a = Console.ReadLine().ToCharArray();
            int[] alph = new int[27];
            for (int i = 0; i < n; i++)
            {
                alph[a[i] - 64]++;
            }
            int open = 0;
            bool check = true;
            int[] doors = new int[27];
            for (int i = 0; i < n; i++)
            {
                if (doors[a[i]-64]==0)
                {
                    open++;
                }
                doors[a[i] - 64]++;
                alph[a[i] - 64]--;
                if (open>k)
                {
                    check = false;
                    break;
                }
                if (alph[a[i]-64]==0)
                {
                    open--;
                }
            }
            if (check)
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
            }

        }

    }
}

using System;
namespace _834B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]), k = int.Parse(input[1]);
            string s = Console.ReadLine();
            int[] last = new int[26];
            for (int i = 0; i < 26; i++)
                last[i] = -1;
            for (int i = n - 1; i >= 0; i--)
                if (last[s[i] - 'A'] == -1)
                    last[s[i] - 'A'] = i;
            bool result = false;
            bool[] used = new bool[26];
            int cnt = 0;
            for (int i = 0; i < n; i++)
            {
                int j = s[i] - 'A';
                if (!used[j])
                {
                    used[j] = true;
                    cnt++;
                }
                if (cnt > k)
                {
                    result = true;
                    break;
                }
                if (last[j] == i)
                {
                    used[j] = false;
                    cnt--;
                }
            }
            Console.WriteLine(result ? "YES" : "NO");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FestiveEvening
{
    class Program
    {
        public class Guard
        {
            public int id { get; set; }
            public Door door { get; set; }
        }

        public class Door
        {
            public bool closed { get; set; } = false;

            public bool guarded { get; set; }
        }

        static void Main(string[] args)
        {
            int[] line1 = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int gt = line1[0];
            int gd = line1[1];

            string guests = Console.ReadLine();
            Dictionary<char, Door> doors = new Dictionary<char, Door>();
            Dictionary<char, int> remaining = new Dictionary<char, int>();
            foreach(char c in guests)
            {
                if(!remaining.ContainsKey(c))
                {
                    remaining.Add(c, 0);
                }
                remaining[c]++;
            }
            String result = "NO";
            for(int i=0; i<gt; i++)
            {
                char c = guests[i];
                if(!doors.ContainsKey(c))
                {
                    doors.Add(c, new Door());
                }
                if(!doors[c].guarded)
                {
                    if(gd == 0)
                    {
                        result = "YES";
                    }
                    else
                    {
                        gd--;
                        doors[c].guarded = true;
                    }
                }
                remaining[c]--;
                if(remaining[c]==0)
                {
                    doors[c].closed = true;
                    doors[c].guarded = false;
                    gd++;
                }
            }
            Console.WriteLine(result);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace CF
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var sr = new InputReader(Console.In))
            //using (var sr = new InputReader(new StreamReader("input.txt")))
            {
                var task = new Task();
                using (var sw = Console.Out) {
                    //using (var sw = new StreamWriter("output.txt")) {
                    task.Solve(sr, sw);
                    //Console.ReadKey();
                }
            }
        }
    }

    internal class Task
    {
        public void Solve(InputReader sr, TextWriter sw)
        {
            var input = sr.ReadArrayOfInt32();
            var n = input[0];
            var k = input[1];
            var str = sr.NextString();
            var counts = new int[26];
            for (var i = 0; i < str.Length; i++) {
                var ch = str[i];
                counts[ch - 'A']++;
            }
            var isOpen = new bool[counts.Length];
            for (var i = 0; i < str.Length; i++) {
                var ch = str[i];
                var indx = ch - 'A';
                if (!isOpen[indx]) {
                    isOpen[indx] = true;
                    k--;
                }
                if (k < 0) {
                    sw.WriteLine("YES");
                    return;
                }
                counts[indx]--;
                if (counts[indx] <= 0) {
                    k++;
                    isOpen[indx] = false;
                }
            }

            sw.WriteLine("NO");
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(NextString());
    }

    public long NextInt64()
    {
        return Int64.Parse(NextString());
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose) {
            if (dispose)
                sr.Close();
            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Text;

namespace CodeForces
{
    class Program
    {
        //'A' - 65
        public static int CharToInt(char c) {
            return ((int) c - 65);
        }

        public static int AlphabetSize = 26;

        public static void Main(string[] args) {
            int[] firsts = new int[AlphabetSize];
            int[] lasts = new int[AlphabetSize];

            for (int i = 0; i < AlphabetSize; i++) {
                firsts[i] = (int)1.0e7;
                lasts[i] = (int)1.0e7;
            }

            long n, k;
            GetTwoInts(out n, out k);
            string guests = Rw();

            for (int i = 0; i < n; i++) {
                int index = CharToInt(guests[i]);
                if (firsts[index] == (int)1.0e7)
                    firsts[index] = i;
                lasts[index] = i;
            }

            Array.Sort(firsts);
            Array.Sort(lasts);
            {
                int i = 0;
                int j = 0;
                int count = 0;
                while (i < AlphabetSize && firsts[i] != (int) 1.0e7 && j < AlphabetSize && lasts[j] != (int) 1.0e7) {
                    if (firsts[i] == lasts[j]) {
                        i++;
                        count++;
                        if (count > k) {
                            Console.WriteLine("YES");
                            return;
                        }
                        j++;
                        count--;
                    }
                    else if (firsts[i] < lasts[j]) {
                        i++;
                        count++;
                    }
                    else {
                        j++;
                        count--;
                    }
                    if (count > k) {
                        Console.WriteLine("YES");
                        return;
                    }

                }

            }
            Console.WriteLine("NO");

            return;

            ans:
            Console.WriteLine(-1);
            return;

        }

        public static string Rw() { return Console.ReadLine(); }

        public static long GetInt() { return Int64.Parse(Rw()); }
        public static long[] GetIntArr() { return Array.ConvertAll(Rw().Split(' '), Int64.Parse); }

        public static double GetDouble() { return Double.Parse(Rw()); }
        public static double[] GetDoubleArr() { return Array.ConvertAll(Rw().Split(' '), DoubleParse); }
        public static double DoubleParse(string s) { return Double.Parse(s, NumberStyles.Any, System.Globalization.CultureInfo.GetCultureInfo("en-US")); }

        public static void GetTwoInts(out long n, out long m)
        {
            long[] input = GetIntArr();
            n = input[0];
            m = input[1];
        }

        public const long Module = 1000000000 + 7;
        public const long Max = (long)1.0e18;

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Algoritms
{
    class Program
    {
        static void Main(string[] args)
        {
            long n, k, open = 0;
            string s;
            string ans = "NO";
            long[] mass = new long[100];
            bool[] stat = new bool[100];
            string[] con = Console.ReadLine().Split(' ');
            n = long.Parse(con[0]);
            k = long.Parse(con[1]);
            s = Console.ReadLine();
            for (int i = 0; i < n; i++)
            {
                mass[s[i]] += 1;
            }
            for (int i = 0; i < n; i++)
            {
                if (stat[s[i]] == false)
                {
                    stat[s[i]] = true;
                    open += 1;
                    mass[s[i]] -= 1;
                }
                else mass[s[i]] -= 1;

                if (open > k) ans = "YES";

                if (mass[s[i]] <= 0)
                {
                    stat[s[i]] = false;
                    open -= 1;
                }
            }

            Console.WriteLine(ans);
            Console.Read();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] toks = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int n = toks[0];
            int k = toks[1];
            int[][] mass = new int[26][];
            for(int i = 0; i < mass.Length; i++)
            {
                int[] temp = { -1, -1 };
                mass[i] = temp;
            }
            string s = Console.ReadLine();
            for(int i = 0; i < n; i++)
            {
                int cur = s[i] - 65;
                if (mass[cur][0] == -1 )
                {
                    mass[cur][0] = i;
                    mass[cur][1] = i;
                }
                mass[cur][1] = i;
            }

            int count = 0;
            for(int i = 0; i < n; i++)
            {
                int temp = 0;
                for(int j = 0; j < 26; j++)
                {
                    if(i >= mass[j][0] && i <= mass[j][1])
                    {
                        temp++;
                    }
                }
                if (temp > count)
                    count = temp;
            }
            if(count > k)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{

	class B
	{
	   static char[] alphabets = new char[26]{'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'};

		static void Main(string[] args)
		{
		    string[] token = Console.ReadLine().Split();
		    int n = int.Parse(token[0]);
		    int k = int.Parse(token[1]);
		    bool[] state = new bool[26];
		    int[] lastOcc = new int[26];

		    string s = Console.ReadLine();
		    for(int i=0;i<s.Length;i++)
		    {
		       lastOcc[Index(s[i])] = i;
		    }
		    int tOdds = 0;
		    for(int i=0;i<s.Length;i++)
		    {
		       if(!state[Index(s[i])]){
		         state[Index(s[i])] = true;
		         tOdds++;
		        }
		       if(tOdds>k)
		       {
		          Console.WriteLine("YES");
		          return;
		       }

		       if(i==lastOcc[Index(s[i])])
		       {
		          state[Index(s[i])] = false;
		          tOdds--;
		       }
		    }

		    Console.WriteLine("NO");
		}

		static int Index(char alpha)
		{
		   int val = 0;
		    for(int i=0;i<alphabets.Length;i++)
		    {
		       if(alpha==alphabets[i]){
		         val = i;
		         break;
		       }
		    }
		    return val;
		}
	}
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            string[] achar = a.Split(new Char[] { ' ' });
            int n =Convert.ToInt32(achar[0]);
            int k = Convert.ToInt32(achar[1]);
            char[] bchar = b.ToCharArray();
            var w = new int[26];
            for (int i = 0; i < n; i++)
                w[bchar[i] - 'A'] = i;
            bool[] unused = new bool[26];
            for (int i = 0; i < n; i++)
            {
                int j = bchar[i] - 'A';
                if (!unused[j])
                {
                    k--;
                    unused[j] = true;
                }
                if (k < 0)
                {
                    Console.WriteLine("YES");
                    break;
                }
                if(w[j] == i)
                {
                    unused[j] = false;
                    k++;
                }
            }
            if (k >= 0)
            {
                Console.WriteLine("NO");
            }
            Console.Read();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Festive.Evening
{
    class Program
    {
        static void Main(string[] args)
        {
            var message = "NO";
            var input1 = Console.ReadLine();
            var array = input1.Split(' ');
            StringBuilder s = new StringBuilder();
            s.Append(Console.ReadLine());
            HashSet<char> openDoors = new HashSet<char>();
            SortedList<char, int> peoplePerDoor = new SortedList<char, int>();

            s.ToString().Distinct().ToList().ForEach(d => peoplePerDoor.Add(d, 0));
            var invites = int.Parse(array[0]);
            var guards = int.Parse(array[1]);
            if (s.ToString().Count(c => c == s[0]) == invites && guards >= 1)
            {
                Console.WriteLine(message);
            }
            else
            {
                s.ToString().ToCharArray().ToList().ForEach(d => peoplePerDoor[d]++);

                for (int i = 0; i < invites; i++)
                {
                    var door = s[i];
                    if (!openDoors.Contains(door))
                    {
                        openDoors.Add(door);
                        guards--;
                    }

                    if (guards < 0)
                    {
                        message = "YES";
                        break;
                    }

                    peoplePerDoor[door]--;
                    if (peoplePerDoor[door]==0)
                    {
                        openDoors.Remove(door);
                        guards++;
                    }

                }
                Console.WriteLine(message);
            }
        }
    }
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            int guardians;
            {
                int[] a;
                {
                    string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\n', '\t', '\r' }, StringSplitOptions.RemoveEmptyEntries);
                    guardians = int.Parse(input[1]);
                    int[] first = new int[26], last = new int[26];
                    a = new int[input[2].Length];
                    for (int i = 1; i < input[2].Length;)
                    {
                        a[i]=input[2][i] - 65;
                        if (first[a[i]] == 0) first[a[i]] = i;
                        last[a[i]] = i++;
                    }
                    first[a[0]=input[2][0] - 65] = 0;
                    input = null;
                    for (int i = 0; i < a.Length;)
                    {
                        if (first[a[i]] == i) if (--guardians < 0) break;
                        if (last[a[i]] == i++) guardians++;
                    }
            }   }
            Console.WriteLine(guardians < 0 ? "YES" : "NO");
        }
    }

using System;
using System.Linq;

namespace CSharp
{
    class _834B
    {
        public static void Main()
        {
            var tokens = Console.ReadLine().Split();

            int n = int.Parse(tokens[0]);
            int k = int.Parse(tokens[1]);

            string s = Console.ReadLine();

            int[] open = new int[n];
            foreach (var group in Enumerable.Range(0, n).GroupBy(i => s[i], i => i))
            {
                int min = int.MaxValue;
                int max = int.MinValue;

                foreach (int index in group)
                {
                    min = Math.Min(min, index);
                    max = Math.Max(max, index);
                }

                for (int i = min; i <= max; i++)
                {
                    if (++open[i] > k)
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                }
            }

            Console.WriteLine("NO");
        }
    }
}

using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;

public class Program
{
    public static void Main(string[] args)
    {
        string input1 = Console.ReadLine();
        string input2 = Console.ReadLine();
        Console.WriteLine(Solve(input1, input2));
    }

    public static string Solve(string input1, string guests)
        {
            var input1Args = input1.Split(' ');
            var numberOfGuests = int.Parse(input1Args[0]);
            var numberOfGuards = int.Parse(input1Args[1]);

            return WasADoorUnwarded(numberOfGuards, guests);
        }

        private static string WasADoorUnwarded(int numberOfGuards, string guests)
        {
            var lastPositionMap = GetLastPositionsMap(guests);
            var guardsPositions = new HashSet<char>();
            var nextAvailableGuard = numberOfGuards;
            for (var i = 0; i < guests.Length; i++)
            {
                var currentGuest = guests[i];
                if (guardsPositions.Contains(currentGuest))
                {
                    if (lastPositionMap[currentGuest] == i)
                    {
                        nextAvailableGuard++;
                        guardsPositions.Remove(currentGuest);
                    }
                    continue;
                }
                if (nextAvailableGuard == 0) return "YES";
                if (!(lastPositionMap[currentGuest] == i))
                {
                    nextAvailableGuard--;
                    guardsPositions.Add(currentGuest);
                }
            }

            return "NO";
        }

        private static Dictionary<char, int> GetLastPositionsMap(string guests)
        {
            var lastPositionMap = new Dictionary<char, int>();
            for (var i = 0; i < guests.Length; i++)
            {
                if (lastPositionMap.ContainsKey(guests[i]))
                {
                    lastPositionMap[guests[i]] = i;
                }
                else
                {
                    lastPositionMap.Add(guests[i], i);
                }
            }

            return lastPositionMap;
        }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		bool[] used = new bool[26];
		int[] L = new int[26];
		int[] R = new int[26];
		for(int i=0;i<N;i++){
			R[S[i] - 'A'] = i;
			used[S[i] - 'A'] = true;
		}
		for(int i=N-1;i>=0;i--){
			L[S[i] - 'A'] = i;
			used[S[i] - 'A'] = true;
		}

		int[] imos = new int[N+1];
		for(int i=0;i<26;i++){
			if(used[i]){
				imos[L[i]]++;
				imos[R[i]+1]--;
			}
		}

		int[] sum = new int[N+1];
		for(int i=0;i<N;i++){
			sum[i+1] = sum[i] + imos[i];
		}
//Console.WriteLine(String.Join(" ",sum));
		bool chk = false;
		for(int i=0;i<=N;i++){
			if(sum[i] > K) chk = true;
		}
		Console.WriteLine(chk ? "YES":"NO");

	}
	int N,K;
	String S;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1];
		S = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static string[] str = Console.ReadLine().Split();
        static int guest = int.Parse(str[0]);
        static int def = int.Parse(str[1]);
        static string all = "";
        static int[] count = new int[26];
        static bool[] free = new bool[26];
        static bool fill = true;

        static int Check(string a)
        {
            if (a == "A") { if (fill == true) { count[0]++; free[0] = false; } else { if (free[0] == false) { free[0] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[0]--; if (count[0] == 0) def++; } }
            if (a == "B") { if (fill == true) { count[1]++; free[1] = false; } else { if (free[1] == false) { free[1] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[1]--; if (count[1] == 0) def++; } }
            if (a == "C") { if (fill == true) { count[2]++; free[2] = false; } else { if (free[2] == false) { free[2] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[2]--; if (count[2] == 0) def++; } }
            if (a == "D") { if (fill == true) { count[3]++; free[3] = false; } else { if (free[3] == false) { free[3] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[3]--; if (count[3] == 0) def++; } }
            if (a == "E") { if (fill == true) { count[4]++; free[4] = false; } else { if (free[4] == false) { free[4] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[4]--; if (count[4] == 0) def++; } }
            if (a == "F") { if (fill == true) { count[5]++; free[5] = false; } else { if (free[5] == false) { free[5] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[5]--; if (count[5] == 0) def++; } }
            if (a == "G") { if (fill == true) { count[6]++; free[6] = false; } else { if (free[6] == false) { free[6] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[6]--; if (count[6] == 0) def++; } }
            if (a == "H") { if (fill == true) { count[7]++; free[7] = false; } else { if (free[7] == false) { free[7] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[7]--; if (count[7] == 0) def++; } }
            if (a == "I") { if (fill == true) { count[8]++; free[8] = false; } else { if (free[8] == false) { free[8] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[8]--; if (count[8] == 0) def++; } }
            if (a == "J") { if (fill == true) { count[9]++; free[9] = false; } else { if (free[9] == false) { free[9] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[9]--; if (count[9] == 0) def++; } }
            if (a == "K") { if (fill == true) { count[10]++; free[10] = false; } else { if (free[10] == false) { free[10] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[10]--; if (count[10] == 0) def++; } }
            if (a == "L") { if (fill == true) { count[11]++; free[11] = false; } else { if (free[11] == false) { free[11] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[11]--; if (count[11] == 0) def++; } }
            if (a == "M") { if (fill == true) { count[12]++; free[12] = false; } else { if (free[12] == false) { free[12] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[12]--; if (count[12] == 0) def++; } }
            if (a == "N") { if (fill == true) { count[13]++; free[13] = false; } else { if (free[13] == false) { free[13] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[13]--; if (count[13] == 0) def++; } }
            if (a == "O") { if (fill == true) { count[14]++; free[14] = false; } else { if (free[14] == false) { free[14] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[14]--; if (count[14] == 0) def++; } }
            if (a == "P") { if (fill == true) { count[15]++; free[15] = false; } else { if (free[15] == false) { free[15] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[15]--; if (count[15] == 0) def++; } }
            if (a == "Q") { if (fill == true) { count[16]++; free[16] = false; } else { if (free[16] == false) { free[16] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[16]--; if (count[16] == 0) def++; } }
            if (a == "R") { if (fill == true) { count[17]++; free[17] = false; } else { if (free[17] == false) { free[17] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[17]--; if (count[17] == 0) def++; } }
            if (a == "S") { if (fill == true) { count[18]++; free[18] = false; } else { if (free[18] == false) { free[18] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[18]--; if (count[18] == 0) def++; } }
            if (a == "T") { if (fill == true) { count[19]++; free[19] = false; } else { if (free[19] == false) { free[19] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[19]--; if (count[19] == 0) def++; } }
            if (a == "U") { if (fill == true) { count[20]++; free[20] = false; } else { if (free[20] == false) { free[20] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[20]--; if (count[20] == 0) def++; } }
            if (a == "V") { if (fill == true) { count[21]++; free[21] = false; } else { if (free[21] == false) { free[21] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[21]--; if (count[21] == 0) def++; } }
            if (a == "W") { if (fill == true) { count[22]++; free[22] = false; } else { if (free[22] == false) { free[22] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[22]--; if (count[22] == 0) def++; } }
            if (a == "X") { if (fill == true) { count[23]++; free[23] = false; } else { if (free[23] == false) { free[23] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[23]--; if (count[23] == 0) def++; } }
            if (a == "Y") { if (fill == true) { count[24]++; free[24] = false; } else { if (free[24] == false) { free[24] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[24]--; if (count[24] == 0) def++; } }
            if (a == "Z") { if (fill == true) { count[25]++; free[25] = false; } else { if (free[25] == false) { free[25] = true; def--; if (def < 0) { Console.WriteLine("YES"); Environment.Exit(0); } } count[25]--; if (count[25] == 0) def++; } }

            return 0;
        }

        static void Main(string[] args)
        {
            for (int i = 0; i < 26; i++)
                free[i] = true;

            all = Console.ReadLine();

            for (int i = 0; i < guest; i++)
            {
                Check(all[i].ToString());
            }

            fill = false;

            for (int i = 0; i < guest; i++)
            {
                Check(all[i].ToString());
            }

            Console.WriteLine("NO");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ca834B
{
    class Program
    {

        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var security = Convert.ToInt32(input[1]);
            var qu = Console.ReadLine();
            var result = "NO";
            var lastPos = new int[26];
            var dictDoor = new Dictionary<int, bool>();
            for (int i = 0; i < qu.Length; i++)
            {
                lastPos[qu[i] - 65] = i;
            }
            for (int i = 0; i < qu.Length; i++)
            {
                if (!dictDoor.ContainsKey(qu[i] - 65))
                    dictDoor[qu[i] - 65] = true;
                if (dictDoor.Keys.Count > security)
                    result = "YES";
                if (lastPos[qu[i] - 65] == i)
                    dictDoor.Remove(qu[i] - 65);
            }

            Console.WriteLine(result);
        }
    }
}

using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Web.UI.WebControls;

namespace Codeforces
{
    class Program : IDisposable
    {
        private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());
        private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());

        private void Solve()
        {
            var s = Console.ReadLine().Split(' ');
            var n = int.Parse(s[0]);
            var k = int.Parse(s[1]);

            var s1 = Console.ReadLine();
            var dict = new Dictionary<char, List<int>>();
            for (int i = 0; i < n; i++)
            {
                if(dict.ContainsKey(s1[i]))
                    dict[s1[i]].Add(i);
                else
                {
                    dict.Add(s1[i], new List<int>() {i});
                }
            }

            int opened = 0;
            for (int i = 0; i < n; i++)
            {
                if (dict[s1[i]].First() == i)
                {
                    opened++;
                    if (opened > k)
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                }

                if (dict[s1[i]].Last() == i)
                {
                    opened--;
                }
                if (opened > k)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }

        int BinarySearch(int[] arr, int q)
        {
            var l = 0;
            var r = arr.Length - 1;
            //int med = -1;
            while (l <= r)
            {
                var med = l + (r - l) / 2;
                if (arr[med] == q)
                {
                    return med;
                }
                if (q < arr[med])
                {
                    r = med - 1;
                }
                else
                {
                    l = med + 1;
                }
            }
            return -1;
        }

        static void Main(string[] args)
        {
            var p = new Program();

            p.Solve();
            //Console.ReadLine();
            //p.Dispose();

        }

        #region Helpers

        private static int ReadInt()
        {
            return int.Parse(textReader.ReadLine());
        }

        private static long ReadLong()
        {
            return long.Parse(textReader.ReadLine());
        }

        private static int[] ReadIntArray()
        {
            return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        #endregion

        public void Dispose()
        {
            textReader.Close();
            textWriter.Close();
        }
    }

   public class ListNode
    {
      public string val;
      public ListNode next;
      public ListNode(string x) { val = x; }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces_Round_num426__Div._2_
{
    class Program
    {
        static void Main(string[] args)
        {
            func2();
        }

        static void func2()
        {
            var aa = Console.ReadLine();
            var a = aa.Split(' ');
            var guestCount = Int32.Parse(a[0]);
            var secCount = Int32.Parse(a[1]);
            var str = Console.ReadLine();
            Dictionary<Char, int[]> d = new Dictionary<char, int[]>();
            for (int i = 0; i < str.Length; i++)
            {
                var c = str[i];
                if (!d.ContainsKey(c))
                {
                    d.Add(c, new[] { i, i });
                }
                else
                {
                    d[c][1] = i;
                }
            }
            var arr = new int[str.Length];
            var carr = new int[arr.Length];
            foreach (var t in d)
            {
                arr[t.Value[0]]++;
                carr[t.Value[1]]++;
            }
            var maxOpenDoors = 0;
            var openDoors = 0;
            for (int i = 0; i < arr.Length; i++)
            {
                openDoors += arr[i];
                if (openDoors > maxOpenDoors)
                    maxOpenDoors = openDoors;
                openDoors -= carr[i];
            }
            if (maxOpenDoors > secCount)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private Tokenizer input;

    public void Solve()
    {
      int n = input.ReadInt();
      int k = input.ReadInt();
      var s = input.ReadToken();
      var l = new int[26];
      for (int i = 0; i < n; i++)
        l[s[i] - 'A'] = i;
      var u = new bool[26];
      for (int i = 0; i < n; i++)
      {
        var j = s[i] - 'A';
        if (!u[j])
        {
          if (k == 0)
          {
            Console.Write("YES");
            return;
          }
          u[j] = true;
          k--;
        }
        if (l[j] == i)
          k++;
      }
      Console.Write("NO");
    }

    private bool OnOneLine(int xa, int ya, int xb, int yb, int xc, int yc)
    {
      return (yb - yc) * xa + (xc - xb) * ya + (xb * yc - xc * yb) == 0;
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }

    #region Service functions

    private static int GCD(int a, int b)
    {
      while (b != 0)
      {
        a %= b;
        int t = b;
        b = a;
        a = t;
      }
      return a;
    }

    #endregion
  }

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public int ReadInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      bool isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = this.reader.Read();
        if (c == -1)
          throw new InvalidOperationException();
      }
      if (!char.IsDigit((char)c))
        throw new InvalidOperationException();
      int result = (char)c - '0';
      c = this.reader.Read();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        if (!char.IsDigit((char)c))
          throw new InvalidOperationException();
        result = result * 10 + (char)c - '0';
        c = this.reader.Read();
      }
      if (isNegative)
        result = -result;
      return result;
    }

    public string ReadLine()
    {
      return reader.ReadLine();
    }

    public long ReadLong()
    {
      return long.Parse(this.ReadToken());
    }

    public double ReadDouble()
    {
      return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);
    }

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

    public long[] ReadLongArray(int n)
    {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      double[] a = new double[n];
      for (int i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWS();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = this.reader.Read();
      }
      return sb.ToString();
    }

    private int SkipWS()
    {
      int c = this.reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = this.reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver(Console.In);
      solver.Solve();
    }
  }

  #endregion
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString();
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n,k;

        string entrances;

        int[] last = new int[30];
        bool[] opened = new bool[30];

        public void Solve()
        {
            n = ioHelper.ReadNextInt();
            k = ioHelper.ReadNextInt();

            entrances = ioHelper.ReadNextToken();

            int i;
            for (i = 0; i < n; i++)
                last[entrances[i] - 'A'] = i;

            int curGuards = 0;
            bool bYes = false;

            for(i=0;i<n;i++)
            {
                if(!opened[entrances[i]-'A'])
                {
                    opened[entrances[i] - 'A'] = true;
                    curGuards++;
                }
                if(curGuards>k)
                {
                    bYes = true;
                    break;
                }

                if (i == last[entrances[i] -'A'])
                {
                    curGuards--;
                    opened[entrances[i] - 'A'] = false;
                }
            }

            if (bYes)
                ioHelper.WriteLine("YES");
            else
                ioHelper.WriteLine("NO");
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;
using System.Threading;

namespace ACM
{
    class Program
    {
        static void Swap<T>(ref T x, ref T y)
        {
            T t = y;
            y = x;
            x = t;
        }

        public static bool NextPermutation<T>(T[] elements) where T : IComparable<T>
        {
            var count = elements.Length;
            var done = true;

            for (var i = count - 1; i > 0; i--)
            {
                var curr = elements[i];
                if (curr.CompareTo(elements[i - 1]) < 0) continue;
                done = false;
                var prev = elements[i - 1];
                var currIndex = i;
                for (var j = i + 1; j < count; j++)
                {
                    var tmp = elements[j];

                    if (tmp.CompareTo(curr) < 0 && tmp.CompareTo(prev) > 0)
                    {
                        curr = tmp;
                        currIndex = j;
                    }
                }

                elements[currIndex] = prev;
                elements[i - 1] = curr;

                for (var j = count - 1; j > i; j--, i++)
                {
                    var tmp = elements[j];
                    elements[j] = elements[i];
                    elements[i] = tmp;
                }
                break;
            }
            return done;
        }

        public static int[] GetArr()
        {
            return Console.ReadLine().Split(' ').ToList().Select(r => int.Parse(r)).ToArray();
        }

        public static long[] GetLongArr()
        {
            return Console.ReadLine().Split(' ').ToList().Select(r => long.Parse(r)).ToArray();
        }

        public static int GetInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static long GetLong()
        {
            return long.Parse(Console.ReadLine());
        }

        public static int[,] GetMatrix(int n, int m)
        {
            int[,] a = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                int[] x = GetArr();
                for (int j = 0; j < m; j++)
                    a[i, j] = x[j];
            }
            return a;
        }

        public static void PrintArr(int[] a)
        {
            for (int i = 0; i < a.Count(); i++)
                Console.Write(a[i] + " ");
            Console.WriteLine();
        }

        static void Main()
        {
            int[] f = GetArr();
            int n = f[0];
            int k = f[1];
            string s = Console.ReadLine();

            int[] open = new int[256];
            int[] closed = new int[256];

            for(int i = 0; i < n; i++)
            {
                if (open[s[i]] == 0) open[s[i]] = i + 1;
            }

            for (int i = n-1; i >= 0; i--)
            {
                if (closed[s[i]] == 0) closed[s[i]] = i + 1;
            }

            int[] a = new int[n+1];
            for (int i = 'A'; i <= 'Z'; i++)
            {
                if ( open[i] > 0 )  a[open[i] - 1]++;
                if ( closed[i] > 0 ) a[closed[i] ]--;
            }
            int res = 0;
            int sum = 0;
            for (int i = 0; i < n; i++)
            {
                sum += a[i];
                if (sum > k) res = 1;
            }
            Console.WriteLine(res > 0 ? "YES" : "NO");
        }
    }
}

using System;
namespace CodeForces {
    class Solve834B {
        const int MAX_GUESTS = 1000000 + 5;
        int n, k;
        string gates;
        int[] openTimes;
        int[] closeTimes;
        int maxOpenGatesCount = 0;

        public void readInput() {
            var parts = Console.ReadLine().Split(' ');
            this.n = int.Parse(parts[0]);
            this.k = int.Parse(parts[1]);
            this.gates = Console.ReadLine();
        }

        public void printAnswer() {
            string unguarded = this.k < this.maxOpenGatesCount ? "YES" : "NO";
            Console.WriteLine(unguarded);
        }

        public void solve() {
            getOpenCloseTimes();
            getMaxOpenGates();
        }

        private void getOpenCloseTimes() {
            this.openTimes = new int[26];
            this.closeTimes = new int[26];

            for (int i = 0; i < 26; i++) {
                this.openTimes[i] = -1;
                this.closeTimes[i] = -1;
            }

            for (int i = 0; i < this.gates.Length; i++) {
                int gateNum = convertGateToNum(this.gates[i]);
                if (this.openTimes[gateNum] == -1) {
                    this.openTimes[gateNum] = i;
                }

                this.closeTimes[gateNum] = i;
            }
        }

        private int convertGateToNum(char gate) {
            return (int)gate - (int)'A';
        }

        private void getMaxOpenGates() {
            for (int i = 0; i < this.n; i++) {
                int openGatesCount = 0;
                for (int gateNum = 0; gateNum < 26; gateNum++) {
                    if (this.isGateOpen(gateNum, i)) {
                        openGatesCount++;
                    }
                }

                if (openGatesCount > maxOpenGatesCount) {
                    this.maxOpenGatesCount = openGatesCount;
                }
            }
        }

        private bool isGateOpen(int gateNum, int time) {
            return this.openTimes[gateNum] <= time && time <= this.closeTimes[gateNum];
        }
    }

    class Runner {
        public static void Main() {
            Solve834B solver = new Solve834B();

            solver.readInput();
            solver.solve();
            solver.printAnswer();
        }
    }
}

using System;

namespace task2
{
    class Program
    {
        static void Main()
        {
            var doors = new bool[26];
            var count = new int[26];
            var input = Console.ReadLine().Split(' ');
            var order = Console.ReadLine().ToCharArray();
            var guards = int.Parse(input[1]);

            foreach (var guest in order)
            {
                count[Index(guest)]++;
            }

            foreach (var guest in order)
            {
                if (!doors[Index(guest)])
                {
                    if (guards-- == 0)
                    {
                        Console.WriteLine("YES");
                        return;
                    }

                    doors[Index(guest)] = true;
                }
                if (--count[Index(guest)] != 0) continue;
                doors[Index(guest)] = true;
                guards++;
            }

            Console.WriteLine("NO");
        }

        private static int Index(char a)
        {
            return a - 65;
        }
    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            string[] achar = a.Split(new Char[] { ' ' });
            int n =Convert.ToInt32(achar[0]);
            int k = Convert.ToInt32(achar[1]);
            char[] bchar = b.ToCharArray();
            int s = 0;
            for (int i = 0; i < n-1; i++)
            {
                if (bchar[i] != bchar[i + 1])
                {
                    for (int j = i + 1; j < n; j++)
                    {
                        if (bchar[i] == bchar[j])
                        {
                            k--;
                        }
                    }
                }
            }
            if(k <= 0)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
            Console.Read();
        }
    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            string[] achar = a.Split(new Char[] { ' ' });
            int n =Convert.ToInt32(achar[0]);
            int k = Convert.ToInt32(achar[1]);
            char[] bchar = b.ToCharArray();
            int s = 0;
            for (int i = 0; i < n-1; i++)
            {
                if (bchar[i] != bchar[i + 1])
                {
                    for (int j = i + 1; j < n; j++)
                    {
                        if (bchar[i] == bchar[j])
                        {
                            k--;
                        }
                    }
                }
            }
            if(k < 0)
            {
                Console.WriteLine("Spizdili");
            }
            else
            {
                Console.WriteLine("Ne spizdili");
            }
            Console.Read();
        }
    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            string[] achar = a.Split(new Char[] { ' ' });
            int n =Convert.ToInt32(achar[0]);
            int k = Convert.ToInt32(achar[1]);
            char[] bchar = b.ToCharArray();
            char ch = '.';
            for (int i = 0; i < bchar.Length - 1; i++)
            {
                if(bchar[i] != bchar[i+1] && bchar[i+1] != ch)
                {
                    ch = bchar[i];
                    k--;
                }
            }
            if(k < 0)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
            Console.Read();
        }
    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            string[] achar = a.Split(new Char[] { ' ' });
            int n =Convert.ToInt32(achar[0]);
            int k = Convert.ToInt32(achar[1]);
            char[] bchar = b.ToCharArray();
            int s = 0;
            for (int i = 0; i < n-1; i++)
            {
                if (bchar[i] != bchar[i + 1])
                {
                    for (int j = i + 1; j < n; j++)
                    {
                        if (bchar[i] == bchar[j])
                        {
                            k--;
                        }
                    }
                }
            }
            if(k < 0)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
            Console.Read();
        }
    }
}

using System;
using System.Linq;

namespace WithConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = input[0];
            var k = input[1];
            var s = Console.ReadLine();

            var guestsByDoor = new int[26];
            var doorWasOpened = new bool[26];

            for (var i = 0; i < s.Length; ++i)
            {
                int door = s[i] - 'A';
                ++guestsByDoor[door];
            }

            bool result = true;
            for (var i = 0; i < s.Length; ++i)
            {
                int door = s[i] - 'A';
                if (!doorWasOpened[door])
                {
                    if (k == 0)
                    {
                        result = false;
                        break;
                    }
                    else
                    {
                        --k;
                        doorWasOpened[door] = true;
                    }
                }
                --guestsByDoor[door];
                if (guestsByDoor[door] == 0)
                {
                    ++k;
                }
            }
            Console.WriteLine(result ? "YES" : "NO");
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Text;

namespace CodeForces
{
    class Program
    {
        //'A' - 65
        public static int CharToInt(char c) {
            return ((int) c - 65);
        }

        public static int AlphabetSize = 26;

        public static void Main(string[] args) {
            int[] firsts = new int[AlphabetSize];
            int[] lasts = new int[AlphabetSize];

            for (int i = 0; i < AlphabetSize; i++) {
                firsts[i] = (int)1.0e7;
                lasts[i] = (int)1.0e7;
            }

            long n, k;
            GetTwoInts(out n, out k);
            string guests = Rw();

            for (int i = 0; i < n; i++) {
                int index = CharToInt(guests[i]);
                if (firsts[index] == (int)1.0e7)
                    firsts[index] = i;
                lasts[index] = i;
            }

            Array.Sort(firsts);
            Array.Sort(lasts);
            {
                int i = 0;
                int j = 0;
                int count = 0;
                while (i < AlphabetSize && firsts[i] != (int) 1.0e7 && j < AlphabetSize && lasts[j] != (int) 1.0e7) {
                    if (firsts[i] == lasts[j]) {
                        i++;
                        j++;
                    }
                    else if (firsts[i] < lasts[j]) {
                        i++;
                        count++;
                    }
                    else {
                        j++;
                        count--;
                    }
                    if (count > k) {
                        Console.WriteLine("YES");
                        return;
                    }

                }

            }
            Console.WriteLine("NO");

            return;

            ans:
            Console.WriteLine(-1);
            return;

        }

        public static string Rw() { return Console.ReadLine(); }

        public static long GetInt() { return Int64.Parse(Rw()); }
        public static long[] GetIntArr() { return Array.ConvertAll(Rw().Split(' '), Int64.Parse); }

        public static double GetDouble() { return Double.Parse(Rw()); }
        public static double[] GetDoubleArr() { return Array.ConvertAll(Rw().Split(' '), DoubleParse); }
        public static double DoubleParse(string s) { return Double.Parse(s, NumberStyles.Any, System.Globalization.CultureInfo.GetCultureInfo("en-US")); }

        public static void GetTwoInts(out long n, out long m)
        {
            long[] input = GetIntArr();
            n = input[0];
            m = input[1];
        }

        public const long Module = 1000000000 + 7;
        public const long Max = (long)1.0e18;

    }
}

using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Web.UI.WebControls;

namespace Codeforces
{
    class Program : IDisposable
    {
        private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());
        private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());

        private void Solve()
        {
            var s = Console.ReadLine().Split(' ');
            var n = int.Parse(s[0]);
            var k = int.Parse(s[1]);

            var s1 = Console.ReadLine();
            var dict = new Dictionary<char, List<int>>();
            for (int i = 0; i < n; i++)
            {
                if(dict.ContainsKey(s1[i]))
                    dict[s1[i]].Add(i);
                else
                {
                    dict.Add(s1[i], new List<int>() {i});
                }
            }

            int opened = 0;
            for (int i = 0; i < n; i++)
            {
                if (dict[s1[i]].First() == i && dict[s1[i]].Last() != i)
                    opened++;
                else if (dict[s1[i]].Last() == i && dict[s1[i]].First() != i)
                    opened--;
                if (opened > k)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }

        int BinarySearch(int[] arr, int q)
        {
            var l = 0;
            var r = arr.Length - 1;
            //int med = -1;
            while (l <= r)
            {
                var med = l + (r - l) / 2;
                if (arr[med] == q)
                {
                    return med;
                }
                if (q < arr[med])
                {
                    r = med - 1;
                }
                else
                {
                    l = med + 1;
                }
            }
            return -1;
        }

        static void Main(string[] args)
        {
            var p = new Program();

            p.Solve();
            //Console.ReadLine();
            //p.Dispose();

        }

        #region Helpers

        private static int ReadInt()
        {
            return int.Parse(textReader.ReadLine());
        }

        private static long ReadLong()
        {
            return long.Parse(textReader.ReadLine());
        }

        private static int[] ReadIntArray()
        {
            return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        #endregion

        public void Dispose()
        {
            textReader.Close();
            textWriter.Close();
        }
    }

   public class ListNode
    {
      public string val;
      public ListNode next;
      public ListNode(string x) { val = x; }
    }
}

using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Web.UI.WebControls;

namespace Codeforces
{
    class Program : IDisposable
    {
        private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());
        private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());

        private void Solve()
        {
            var s = Console.ReadLine().Split(' ');
            var n = int.Parse(s[0]);
            var k = int.Parse(s[1]);

            var s1 = Console.ReadLine();
            var dict = new Dictionary<char, List<int>>();
            for (int i = 0; i < n; i++)
            {
                if(dict.ContainsKey(s1[i]))
                    dict[s1[i]].Add(i);
                else
                {
                    dict.Add(s1[i], new List<int>() {i});
                }
            }

            int opened = 0;
            for (int i = 0; i < n; i++)
            {
                if (dict[s1[i]].First() == i)
                {
                    opened++;
                    if (opened > k)
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                }

                else if (dict[s1[i]].Last() == i)
                {
                    opened--;
                }
                if (opened > k)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }

        int BinarySearch(int[] arr, int q)
        {
            var l = 0;
            var r = arr.Length - 1;
            //int med = -1;
            while (l <= r)
            {
                var med = l + (r - l) / 2;
                if (arr[med] == q)
                {
                    return med;
                }
                if (q < arr[med])
                {
                    r = med - 1;
                }
                else
                {
                    l = med + 1;
                }
            }
            return -1;
        }

        static void Main(string[] args)
        {
            var p = new Program();

            p.Solve();
            //Console.ReadLine();
            //p.Dispose();

        }

        #region Helpers

        private static int ReadInt()
        {
            return int.Parse(textReader.ReadLine());
        }

        private static long ReadLong()
        {
            return long.Parse(textReader.ReadLine());
        }

        private static int[] ReadIntArray()
        {
            return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        #endregion

        public void Dispose()
        {
            textReader.Close();
            textWriter.Close();
        }
    }

   public class ListNode
    {
      public string val;
      public ListNode next;
      public ListNode(string x) { val = x; }
    }
}

using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Web.UI.WebControls;

namespace Codeforces
{
    class Program : IDisposable
    {
        private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());
        private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());

        private void Solve()
        {
            var s = Console.ReadLine().Split(' ');
            var n = int.Parse(s[0]);
            var k = int.Parse(s[1]);

            var s1 = Console.ReadLine();
            var dict = new Dictionary<char, List<int>>();
            for (int i = 0; i < s1.Length; i++)
            {
                if(dict.ContainsKey(s1[i]))
                    dict[s1[i]].Add(i);
                else
                {
                    dict.Add(s1[i], new List<int>() {i});
                }
            }

            int opened = 0;
            for (int i = 0; i < s1.Length; i++)
            {
                if (dict[s1[i]][0] == i)
                    opened++;
                else if (dict[s1[i]].Last() == i)
                    opened--;
                if (opened > k)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }

        int BinarySearch(int[] arr, int q)
        {
            var l = 0;
            var r = arr.Length - 1;
            //int med = -1;
            while (l <= r)
            {
                var med = l + (r - l) / 2;
                if (arr[med] == q)
                {
                    return med;
                }
                if (q < arr[med])
                {
                    r = med - 1;
                }
                else
                {
                    l = med + 1;
                }
            }
            return -1;
        }

        static void Main(string[] args)
        {
            var p = new Program();

            p.Solve();
            //Console.ReadLine();
            //p.Dispose();

        }

        #region Helpers

        private static int ReadInt()
        {
            return int.Parse(textReader.ReadLine());
        }

        private static long ReadLong()
        {
            return long.Parse(textReader.ReadLine());
        }

        private static int[] ReadIntArray()
        {
            return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        #endregion

        public void Dispose()
        {
            textReader.Close();
            textWriter.Close();
        }
    }

   public class ListNode
    {
      public string val;
      public ListNode next;
      public ListNode(string x) { val = x; }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces_Round_num426__Div._2_
{
    class Program
    {
        static void Main(string[] args)
        {
            func2();
        }

        static void func2()
        {
            var aa = Console.ReadLine();
            var a = aa.Split(' ');
            var guestCount = Int32.Parse(a[0]);
            var secCount = Int32.Parse(a[1]);
            var str = Console.ReadLine();
            Dictionary<Char, int[]> d = new Dictionary<char, int[]>();
            for (int i = 0; i < str.Length; i++)
            {
                var c = str[i];
                if (!d.ContainsKey(c))
                {
                    d.Add(c, new[] { i, i });
                }
                else
                {
                    d[c][1] = i;
                }
            }
            var arr = new int[str.Length];
            var carr = new int[arr.Length];
            foreach (var t in d)
            {
                arr[t.Value[0]]++;
                carr[t.Value[1]]++;
            }
            var maxOpenDoors = 0;
            var openDoors = 0;
            for (int i = 0; i < arr.Length; i++)
            {
                openDoors += arr[i];
                openDoors -= carr[i];
                if (openDoors > maxOpenDoors)
                    maxOpenDoors = openDoors;
            }
            if (maxOpenDoors > secCount)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TorzestevennijVe4er
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int k = int.Parse(s[1]);

            string guests = Console.ReadLine();

            Dictionary<char, int> last = new Dictionary<char, int>();
            Dictionary<char, int> first = new Dictionary<char, int>();

            for (int i=0;i<n;i++)
            {
                if (!last.ContainsKey(guests[i]))
                    last.Add(guests[i], i);
                else
                    last[guests[i]] = i;

                if (!first.ContainsKey(guests[i]))
                    first.Add(guests[i], i);
            }

            int open = 0;
            bool ans = false;

            for (int i=0;i<n;i++)
            {
                if (first[guests[i]] == i) open++;
                if (last[guests[i]] == i) open--;

                if (open>k)
                {
                    ans = true;
                    break;
                }
            }

            if (ans)
                Console.Write("YES");
            else
                Console.Write("NO");
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace The_Festive_Evening
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();
            int k = Next();

            var nn = new int[n];
            for (int i = 0; i < n; i++)
            {
                nn[i] = Next();
            }

            var close = new int['Z' - 'A' + 1];
            for (int i = 0; i < n; i++)
            {
                close[nn[i]] = i;
            }

            int opened = 0;
            int maxopened = 0;
            var f = new bool[close.Length];
            for (int i = 0; i < n; i++)
            {
                if (!f[nn[i]])
                {
                    opened++;
                    f[nn[i]] = true;
                }

                if (close[nn[i]] == i)
                {
                    opened--;
                }

                maxopened = Math.Max(maxopened, opened);
            }

            writer.WriteLine(maxopened > k ? "Yes" : "No");
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c >= 'A' && c <= 'Z')
                    return c - 'A';
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Algoritms
{
    class Program
    {
        static void Main(string[] args)
        {
            long n, k, open = 0;
            string s;
            string ans = "NO";
            long[] mass = new long[100];
            bool[] stat = new bool[100];
            string[] con = Console.ReadLine().Split(' ');
            n = long.Parse(con[0]);
            k = long.Parse(con[1]);
            s = Console.ReadLine();
            for (int i = 0; i < n; i++)
            {
                mass[s[i]] += 1;
            }
            for (int i = 0; i < n; i++)
            {
                if (stat[s[i]] == false)
                {
                    stat[s[i]] = true;
                    open += 1;
                    mass[s[i]] -= 1;
                }
                else mass[s[i]] -= 1;

                if (mass[s[i]] <= 0)
                {
                    stat[s[i]] = false;
                    open -= 1;
                }

                if (open > k) ans = "YES";
            }

            Console.WriteLine(ans);
            Console.Read();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] toks = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int n = toks[0];
            int k = toks[1];
            int[][] mass = new int[26][];
            for(int i = 0; i < mass.Length; i++)
            {
                int[] temp = { -1, -1 };
                mass[i] = temp;
            }
            string s = Console.ReadLine();
            for(int i = 0; i < n; i++)
            {
                int cur = s[i] - 65;
                if (mass[cur][0] == -1 )
                {
                    mass[cur][0] = i;
                    mass[cur][1] = i;
                }
                mass[cur][1] = i;
            }

            int count = 0;
            for(int i = 0; i < n; i++)
            {
                int temp = 0;
                for(int j = 0; j < 26; j++)
                {
                    if(i >= mass[j][0] && i <= mass[j][1])
                    {
                        temp++;
                    }
                    if (mass[j][0] == -1)
                        break;
                }
                if (temp > count)
                    count = temp;
            }
            if(count > k)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
            Console.ReadLine();
        }
    }
}

using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;

public class Program
{
    public static void Main(string[] args)
    {
        string input1 = Console.ReadLine();
        string input2 = Console.ReadLine();
        Console.WriteLine(Solve(input1, input2));
    }

    public static string Solve(string input1, string guests)
        {
            var input1Args = input1.Split(' ');
            var numberOfGuests = int.Parse(input1Args[0]);
            var numberOfGuards = int.Parse(input1Args[1]);

            return WasADoorUnwarded(numberOfGuards, guests);
        }

        private static string WasADoorUnwarded(int numberOfGuards, string guests)
        {
            var lastPositionMap = GetLastPositionsMap(guests);
            var guardsPositions = new HashSet<char>();
            var nextAvailableGuard = numberOfGuards;
            for (var i = 0; i < guests.Length; i++)
            {
                var currentGuest = guests[i];
                if (lastPositionMap[currentGuest] == i) nextAvailableGuard++;
                if (guardsPositions.Contains(currentGuest)) continue;
                if (nextAvailableGuard == 0) return "YES";
                nextAvailableGuard--;
                guardsPositions.Add(currentGuest);
            }

            return "NO";
        }

        private static Dictionary<char, int> GetLastPositionsMap(string guests)
        {
            var lastPositionMap = new Dictionary<char, int>();
            for (var i = 0; i < guests.Length; i++)
            {
                if (lastPositionMap.ContainsKey(guests[i]))
                {
                    lastPositionMap[guests[i]] = i;
                }
                else
                {
                    lastPositionMap.Add(guests[i], i);
                }
            }

            return lastPositionMap;
        }
}

using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;

public class Program
{
    public static void Main(string[] args)
    {
        string input1 = Console.ReadLine();
        string input2 = Console.ReadLine();
        Console.WriteLine(Solve(input1, input2));
    }

    public static string Solve(string input1, string guests)
        {
            var input1Args = input1.Split(' ');
            var numberOfGuests = int.Parse(input1Args[0]);
            var numberOfGuards = int.Parse(input1Args[1]);

            return WasADoorUnwarded(numberOfGuards, guests);
        }

        private static string WasADoorUnwarded(int numberOfGuards, string guests)
        {
            var lastPositionMap = GetLastPositionsMap(guests);
            var guardsPositions = new HashSet<char>();
            var nextAvailableGuard = numberOfGuards;
            for (var i = 0; i < guests.Length; i++)
            {
                var currentGuest = guests[i];
                if (guardsPositions.Contains(currentGuest))
                {
                    if (lastPositionMap[currentGuest] == i) nextAvailableGuard++;
                    continue;
                }
                if (nextAvailableGuard == 0) return "YES";
                nextAvailableGuard--;
                guardsPositions.Add(currentGuest);
            }

            return "NO";
        }

        private static Dictionary<char, int> GetLastPositionsMap(string guests)
        {
            var lastPositionMap = new Dictionary<char, int>();
            for (var i = 0; i < guests.Length; i++)
            {
                if (lastPositionMap.ContainsKey(guests[i]))
                {
                    lastPositionMap[guests[i]] = i;
                }
                else
                {
                    lastPositionMap.Add(guests[i], i);
                }
            }

            return lastPositionMap;
        }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		bool[] used = new bool[26];
		int[] L = new int[26];
		int[] R = new int[26];
		for(int i=0;i<N;i++){
			R[S[i] - 'A'] = i;
			used[S[i] - 'A'] = true;
		}
		for(int i=N-1;i>=0;i--){
			L[S[i] - 'A'] = i;
			used[S[i] - 'A'] = true;
		}

		int[] imos = new int[N+1];
		for(int i=0;i<26;i++){
			if(used[i]){
				imos[L[i]]++;
				imos[R[i]+1]--;
			}
		}

		int[] sum = new int[N+1];
		for(int i=0;i<N;i++){
			sum[i+1] = sum[i] + imos[i];
		}
//Console.WriteLine(String.Join(" ",sum));
		bool chk = false;
		for(int i=0;i<N;i++){
			if(imos[i] > K) chk = true;
		}
		Console.WriteLine(chk ? "YES" : "NO");

	}
	int N,K;
	String S;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1];
		S = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ca834B
{
    class Program
    {

        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var security = Convert.ToInt32(input[1]);
            var qu = Console.ReadLine();
            var arr = new int[26];
            Array.Clear(arr, 0, arr.Length);
            var result = "NO";
            for (int i = 0; i < qu.Length; i++)
            {
                arr[qu[i] - 65]++;
                var open = (from p in arr
                 where p == 1
                 select 1).Count();
                if (open > security)
                    result = "YES";
            }
            if ((from p in arr
                 where p == 1
                 select 1).Count() == arr.Length)
            {
                result = "NO";
            }
            Console.WriteLine(result);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ca834B
{
    class Program
    {

        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var security = Convert.ToInt32(input[1]);
            var qu = Console.ReadLine();
            var arr = new int[26];
            Array.Clear(arr, 0, arr.Length);
            var result = "NO";
            for (int i = 0; i < qu.Length; i++)
            {
                arr[qu[i] - 65]++;
                var open = (from p in arr
                 where p == 1
                 select 1).Count();
                if (open > security)
                    result = "YES";
            }
            Console.WriteLine(result);
        }
    }
}