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

namespace Exawizards
{
    class C
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToArray();
            int N = a[0], Q = a[1];
            string s = Console.ReadLine();

            List<char[]> list = new List<char[]>();
            for(int i = 0; i < Q; i++)
            {
                char[] b = Console.ReadLine().Split(' ').Select(z => char.Parse(z)).ToArray();
                list.Add(b);
            }
            list.Reverse();

            int indexL=0, indexR=N-1;
            bool[] danger = new bool[N];
            foreach(char[] b in list)
            {
                char t = b[0], d = b[1];
                if (d == 'R')
                {
                    if (indexR >= 0 && s[indexR] == t)
                    {
                        indexR--;
                    }
                }
                else
                {
                    if (indexL < N && s[indexL] == t)
                    {
                        indexL++;
                    }
                }
            }

            int r = Math.Max(indexR - indexL + 1, 0);
            Console.WriteLine(r);
        }

    }
}
