n,q = (int(i) for i in input().split())
s = '#'+input()+'#'
l = 0
r = n+1
a = [list(input().split()) for i in range(q)]
for i in range(q):
    t,d = a[i]
    if s[l+1] == t and d =='L':
        l += 1
    elif s[l] == t and d == 'R':
        l -= 1
    if s[r] == t and d == 'L':
        r += 1
    elif s[r-1] == t and d == 'R':
        r -= 1
print(max(0,r-l-1))