n, q = [int(x) for x in input().split()]
s = input()
td = [input().split() for _ in range(q)]
lo, hi = 0, n-1
 
for t, d in reversed(td):
    if d == "L" and s[lo] == t:
        lo += 1
    elif d == "R" and s[hi] == t:
        hi -= 1
    if lo > hi:
        print(0)
        break
else:
    print(hi-lo+1)