import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

idx = {chr(i): [] for i in range(65, 92)}

n,q = li()
s = ns()


from_left = [(si, 'L') for si in s]
from_right = [(si, 'R') for si in s[::-1]]

query = [tuple(ls()) for _ in range(q)]

left_cur = 0
right_cur = 0

for qi in query[::-1]:
    if left_cur < n:
        if qi == from_left[left_cur]:
            left_cur += 1
        
    if right_cur < n:
        if qi == from_right[right_cur]:
            right_cur += 1
        
print(max(n - (left_cur + right_cur), 0))