n, q = map(int, input().strip().split(' '))
s = input()
basyo = [str(c) for c in s]
t = [0]*q
d = [0]*q
for i in range(q):
    t[i], d[i] = map(str, input().strip().split(' '))
kazu = 0
for i in range(n):
    now = i
    for j in range(q):
        if d[j] == "L" and basyo[now] == t[j]:
            if now == 0:
                now = "no"
                break
            else:
                now = now-1
        if d[j] == "R" and basyo[now] == t[j]:
            if now == n-1:
                now = "no"
                break
            else:
                now = now+1
    if type(now) is int:
        kazu = kazu+1
print(kazu)