N,Q = map(int, input().split())
s = '_'+input()+'_'
td = [input().split() for _ in range(Q)]
right = N+1
left = 0
for t,d in reversed(td):
    if t == s[right-1] and d =='R':
        right -= 1
    elif t == s[right] and d == 'L':
        right += 1
    if t == s[left+1] and d == 'L':
        left += 1
    elif t == s[left] and d == 'R':
        left -= 1
print(max(0,right-left-1))
