import std.stdio, std.conv, std.string, std.array, std.math, std.regex, std.range, std.ascii;
import std.typecons, std.functional;
import std.algorithm, std.container;


struct Qes{
    char t;
    char d;
}
long N;
string S;
Qes[] qs;
long calc(long s, long g)
{
    long pos = (s+g)/2;
    foreach(q; qs)
    {
        if(q.t!=S[pos-1])continue;
        pos += q.d=='R'?1:-1;
        if(pos==0)break;
        if(pos==N+1)break;
    }
    if(s==g)
    {
        if(pos==0)
            return s;
        else
            return 0;
    }
    if(abs(s-g)==1)
    {
        return max(calc(s, s) , calc(g, g));
    }
    return pos==0 ? calc((s+g)/2, g) : calc(s, (s+g)/2);
}
long calc2(long s, long g)
{
    if(abs(s-g)==1)
    {
        return max(calc2(s, s) , calc2(g, g));
    }

    long pos = (s+g)/2;
    foreach(q; qs)
    {
        if(q.t!=S[pos-1])continue;
        pos += q.d=='R'?1:-1;
        if(pos==N+1)break;
        if(pos==0)break;
    }
    if(s==g)
    {
        if(pos==N+1)
            return N-s+1;
        else
            return 0;
    }
    return pos==N+1 ? calc2(s, (s+g)/2) : calc2((s+g)/2, g);
}
void main()
{
    N = scanElem;
    long Q = scanElem;
    S = readln.strip;
    foreach(i; 0..Q)
    {
        char t = scanElem!char;
        char d = scanElem!char;
        qs ~= Qes(t,d);
    }
    auto l = calc(1, N);
    auto r = calc2(1,N);
    writeln(N-l-r);
}


class UnionFind{
    UnionFind parent = null;

    void merge(UnionFind a)
    {
        if(same(a)) return;
        a.root.parent = this.root;
    }
    UnionFind root()
    {
        if(parent is null)return this;
        return parent = parent.root;
    }
    bool same(UnionFind a)
    {
        return this.root == a.root;
    }
}

void scanValues(TList...)(ref TList list)
{
    auto lit = readln.splitter;
    foreach (ref e; list)
    {
        e = lit.fornt.to!(typeof(e));
        lit.popFront;
    }
}

T[] scanArray(T = long)()
{
    return readln.split.to!(long[]);
}

void scanStructs(T)(ref T[] t, size_t n)
{
    t.length = n;
    foreach (ref e; t)
    {
        auto line = readln.split;
        foreach (i, ref v; e.tupleof)
        {
            v = line[i].to!(typeof(v));
        }
    }
}

T scanElem(T = long)()
{
    char[] res;
    int c = ' ';
    while (isWhite(c) && c != -1)
    {
        c = getchar;
    }
    while (!isWhite(c) && c != -1)
    {
        res ~= cast(char) c;
        c = getchar;
    }
    return res.strip.to!T;
}

template fold(fun...) if (fun.length >= 1)
{
    auto fold(R, S...)(R r, S seed)
    {
        static if (S.length < 2)
        {
            return reduce!fun(seed, r);
        }
        else
        {
            import std.typecons : tuple;

            return reduce!fun(tuple(seed), r);
        }
    }
}

template cumulativeFold(fun...)
if (fun.length >= 1)
{
    import std.meta : staticMap;
    private alias binfuns = staticMap!(binaryFun, fun);

    auto cumulativeFold(R)(R range)
    if (isInputRange!(Unqual!R))
    {
        return cumulativeFoldImpl(range);
    }

    auto cumulativeFold(R, S)(R range, S seed)
    if (isInputRange!(Unqual!R))
    {
        static if (fun.length == 1)
            return cumulativeFoldImpl(range, seed);
        else
            return cumulativeFoldImpl(range, seed.expand);
    }

    private auto cumulativeFoldImpl(R, Args...)(R range, ref Args args)
    {
        import std.algorithm.internal : algoFormat;

        static assert(Args.length == 0 || Args.length == fun.length,
            algoFormat("Seed %s does not have the correct amount of fields (should be %s)",
                Args.stringof, fun.length));

        static if (args.length)
            alias State = staticMap!(Unqual, Args);
        else
            alias State = staticMap!(ReduceSeedType!(ElementType!R), binfuns);

        foreach (i, f; binfuns)
        {
            static assert(!__traits(compiles, f(args[i], e)) || __traits(compiles,
                    { args[i] = f(args[i], e); }()),
                algoFormat("Incompatible function/seed/element: %s/%s/%s",
                    fullyQualifiedName!f, Args[i].stringof, E.stringof));
        }

        static struct Result
        {
        private:
            R source;
            State state;

            this(R range, ref Args args)
            {
                source = range;
                if (source.empty)
                    return;

                foreach (i, f; binfuns)
                {
                    static if (args.length)
                        state[i] = f(args[i], source.front);
                    else
                        state[i] = source.front;
                }
            }

        public:
            @property bool empty()
            {
                return source.empty;
            }

            @property auto front()
            {
                assert(!empty, "Attempting to fetch the front of an empty cumulativeFold.");
                static if (fun.length > 1)
                {
                    import std.typecons : tuple;
                    return tuple(state);
                }
                else
                {
                    return state[0];
                }
            }

            void popFront()
            {
                assert(!empty, "Attempting to popFront an empty cumulativeFold.");
                source.popFront;

                if (source.empty)
                    return;

                foreach (i, f; binfuns)
                    state[i] = f(state[i], source.front);
            }

            static if (isForwardRange!R)
            {
                @property auto save()
                {
                    auto result = this;
                    result.source = source.save;
                    return result;
                }
            }

            static if (hasLength!R)
            {
                @property size_t length()
                {
                    return source.length;
                }
            }
        }

        return Result(range, args);
    }
}

struct Factor
{
    long n;
    long c;
}

Factor[] factors(long n)
{
    Factor[] res;
    for (long i = 2; i ^^ 2 <= n; i++)
    {
        if (n % i != 0)
            continue;

        int c;
        while (n % i == 0)
        {
            n = n / i;
            c++;
        }
        res ~= Factor(i, c);
    }
    if (n != 1)
        res ~= Factor(n, 1);

    return res;
}
long[] primes(long n)
{
    if(n<2)return [];
    auto table = new long[n+1];
    long[] res;
    for(int i = 2;i<=n;i++)
    {
        if(table[i]==-1) continue;
        for(int a = i;a<table.length;a+=i)
        {
            table[a] = -1;
        }
        res ~= i;
    }
    return res;
}
bool isPrime(long n)
{
    if (n <= 1)
        return false;
    if (n == 2)
        return true;
    if (n % 2 == 0)
        return false;
    for (long i = 3; i ^^ 2 <= n; i += 2)
        if (n % i == 0)
            return false;
    return true;
}

Measured memory_bytes: 4092