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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var nq = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var n = nq[0];
        var q = nq[1];
        var s = Console.ReadLine().Trim();
        var qs = new Tuple<char, int>[q];
        for (int i = 0; i < qs.Length; i++)
        {
            var td = Console.ReadLine().Split().Select(x => x[0]).ToArray();
            qs[i] = Tuple.Create(td[0], td[1] == 'R' ? 1 : -1);
        }

        var p = -1;
        var left = p;
        for (int i = 0; i < qs.Length; i++)
        {
            var ii = qs.Length - 1 - i;
            if (p > s.Length - 1)
            {
                break;
            }

            if (p >= 0)
            {
                if (s[p] == qs[ii].Item1 && qs[ii].Item2 > 0)
                {
                    if (left == p)
                    {
                        left--;
                    }
                    p--;
                    continue;
                }
            }

            var prev = p - qs[ii].Item2;
            if (prev < 0 || prev > s.Length - 1 || s[prev] != qs[ii].Item1)
            {
                continue;
            }

            left = Math.Max(left, prev);
            p = prev;
        }
        p = s.Length;
        var right = p;
        for (int i = 0; i < qs.Length; i++)
        {
            var ii = qs.Length - 1 - i;
            if (p < 0)
            {
                break;
            }

            if (p <= s.Length - 1)
            {
                if (s[p] == qs[ii].Item1 && qs[ii].Item2 < 0)
                {
                    if (left == p)
                    {
                        right++;
                    }
                    p++;
                    continue;
                }
            }

            var prev = p - qs[ii].Item2;
            if (prev < 0 || prev > s.Length - 1 || s[prev] != qs[ii].Item1)
            {
                continue;
            }

            right = Math.Min(right, prev);
            p = prev;
        }
        
        Console.WriteLine(right - (left + 1));
    }
}
