n, q = [int(i) for i in input().split(" ")]
s = input()
qs = [[]] * q

for i in range(0, q):
    qs[i] = input().split(" ")

l = 0
r = 0
for i in reversed(range(0, q)):
    if s[l] == qs[i][0] and qs[i][1] == "L":
        l += 1
    if l > 0 and s[l - 1] == qs[i][0] and qs[i][1] == "R":
        l -= 1
        break

for i in reversed(range(0, q)):
    if s[::-1][r] == qs[i][0] and qs[i][1] == "R":
        r += 1
    if r > 0 and s[::-1][r - 1] == qs[i][0] and qs[i][1] == "L":
        r -= 1
        break
    
print(max(n - l - r, 0))