n, q = [int(x) for x in input().strip().split(" ")]
S = input().strip()
s, e = 0, n-1

import sys
qs = []
for line in sys.stdin:
    qs.append([x for x in line.strip().split(" ")])

for q in qs[::-1]:
    t, d = q
    if d == 'L':
        if S[s] == t:
            if s < n-1:
                s += 1
        if e < n-1:
            if S[e+1] == t:
                e += 1
    if d == 'R':
        if s > 0:
            if S[s-1] == t:
                s -= 1
        if S[e] == t:
            if e > 0:
                e -= 1
    if s == e:
        break
if s == e:
    print(0)
elif s < e:
    print(n - s - (n - 1 - e))
