N, Q = map(int, input().split())
s = '##'+input()+'##'
td = [input().split() for _ in range(Q)]

l, r = 1, N + 2
dp = [0] * (N + 4)

for t, d in td[::-1] :
    if s[l + 1] == t and d == 'L' :
        l += 1
        dp[l] = 1
        
    if s[l - 1] == t and d == 'R' :
        l -= 1
        dp[l] = 1
        
    if s[r + 1] == t and d == 'L' :
        r += 1
        dp[r] = 1
    
    if s[r - 1] == t and d == 'R' :
        r -= 1
        dp[r] = 1

print(N - sum(dp))