using System;
using System.Linq;

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

            var res = s.Select((c, i) => new Golem(c, i)).ToList();

            for (int i = 0; i < q; i++) {
                var line = Console.ReadLine().Split(' ').ToArray();
                var t = line[0];
                var d = line[1];
                foreach (var golem in res.Where(golem => golem.c == t)) {
                    golem.Move(d, n);
                }
            }

            Console.WriteLine(res.Count(golem => golem.valid));
        }

        class Golem {
            public Golem(char c, int pos) {
                this.c = c.ToString();
                this.pos = pos;
                valid = true;
            }

            public string c;
            public int pos;
            public bool valid;

            public void Move(string lr, int n) {
                if (!valid) return;
                if (lr == "L") {
                    pos--;
                } else {
                    pos++;
                }

                if (pos < 0 || n <= pos) valid = false;
            }
        }
    }
}