N, Q = map(int, input().split())
string = input()
i = 0
j = N - 1
ans = 0
td = []
for _ in range(Q):
    td.append(input().split())


for t, d in reversed(td):
    if string[i] == t and d == "L":
        i += 1
        ans += 1
    if string[j] == t and d == "R":
        j -= 1
        ans += 1
print(N-ans)
