# 2019/03/30
# エクサウィザーズ 2019 - C

# Input
n, q = map(int,input().split())
s = input()
td = list()

for i in range(q):
    td.append(list(input().split()))

lidx = 0
ridx = n-1
ls_c = s[lidx]
rs_c = s[ridx]
for i in range(q - 1, -1, -1):
    # Search left
    if td[i][0] == ls_c:
        if td[i][1] == "L":
            lidx += 1
            ls_c = s[lidx]
    
    # Search right
    if td[i][0] == rs_c:
        if td[i][1] == "R":
            ridx -= 1
            rs_c = s[ridx]

ans = n - (lidx + ((n - 1) - ridx))

# Output
print(ans)
