n, q = [int(item) for item in input().split()]
s = input().rstrip()
td = [[item for item in input().split()] for _ in range(q)]

max_l = -1 
min_r = n
l = -1; r = n
for t, d in td[::-1]:
    if d == "L":
        if t == s[l+1]:
            l += 1
    else:
        if(l > 0):
            if t == s[l-1]:
                l -= 1
    max_l = max(max_l, l)
    if d == "R":
        if t == s[r-1]:
            r -= 1
    else:
        if(r < n-1):
            if t == s[r+1]:
                r += 1
    min_r = min(min_r, r)

    # Run out golems
    if l == n-1 or r == 0:
        print(0)
        exit()
if min_r - max_l > 0:
    print(min_r - max_l - 1)
else:
    print(0)