n,q = map(int,input().split())
s = list(input())
mag = [input().split() for i in range(q)]

for i in range(q):
     j = q-i-1
     if mag[j] == [s[0],"L"]:
          s.remove(s[0])
     elif mag[j] == [s[-1],"R"]:
          s.pop()
     if len(s) == 0:
          break
print(len(s))