N, Q = map(int, input().split())
s = input()
go = {'L':-1, 'R':1}
golem = [i for i in range(N)]
for _ in range(Q):
    t, d = input().split()
    for i in range(N):
        if (golem[i] >= 0 and N > golem[i]) and s[golem[i]] == t:
            golem[i] += go[d]
print(sum([1 for p in golem if p >= 0 and N > p]))
