N, Q = list(map(int, input().split()))
s = input()
t = [0] * Q
d = [0] * Q
for x in range(Q):
    t[x], d[x] = input().split()
g = [1] * (N + 2)
m = {}
for x in range(len(s)):
    m[s[x]] = []
for x in range(len(s)):
    m[s[x]].append(x)
LorR = {"L": -1, "R":1}
for x in range(Q):
    if t[x] in m:
        for y in m[t[x]]:
            g[y + 1 + LorR[d[x]]] += g[y + 1]
            g[y + 1] = 0

print(N + 2 - g[0] - g[N + 1])
