N, Q = list(map(int, input().split()))
s = input()
td = [input().split() for i in range(Q)]

td.reverse()

nl = 0
nr = N - 1

for t,d in td:
    if d == "L":
        if t==s[nl] and nl < N:
            nl += 1
        if t == s[nr]:
            nr += 1
    if d == "R":
        if t == s[nr] and nr >= 0:
            nr -= 1
        if t == s[nl-1]:
            nl -= 1

print(nr-nl-1)