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

td.reverse()
L_s = 0
R_s = N + 1
for i, j in enumerate(td):
    td[i][0], td[i][1] = j

    if td[i][1] == "R":
        if td[i][0] == s[R_s - 1]:
            R_s -= 1
        if td[i][0] == s[L_s]:
            L_s -= 1

    if td[i][1] == "L":
        if td[i][0] == s[R_s]:
            R_s += 1
        if td[i][0] == s[L_s + 1]:
            L_s += 1

print(max(0, R_s - L_s - 1))