import sys
N,Q = [int(i) for i in input().split()]
s = sys.stdin.readline()
li = [[i for i in input().split()] for _ in range(Q)]

ans = 0
p = 1
q = 0
flag_S = s[q]
flag_N = s[N-p]
r_flag = 0
l_flag = 0
t_tmp = 0
l_tmp = 0
for i in range(Q):
    t,d = li[-i]
    if t == flag_N and d == 'R':
        if l_flag == 0:
            ans += 1 + l_tmp
            l_tmp = 0
        if l_flag:
            l_flag -= 1
            l_tmp += 1
        p += 1
        if p <= N:
            flag_N = s[N-p]
        else:
            flag_N = ''
        if flag_S == t:
            r_flag += 1

    if t == flag_S and d == 'L':
        if r_flag == 0:
            ans += 1 + t_tmp
            t_tmp = 0
        if r_flag:
            r_flag -= 1
            t_tmp += 1
        q += 1
        if q < N:
            flag_S = s[q]
        else:
            flag_S = ''
        if flag_S == t:
            l_flag += 1


if N >= ans:
    print(N-ans)
else:
    print(0)
