def main():
    n,q=map(int,input().split())
    s=input()
    td=[list(input().split()) for _ in [0]*q]
    l=0
    r=n-1
    for t,d in td[::-1]:
        if d=="R":
            if r<=n-1:
                if s[r]==t:
                    r-=1
            if l>=1:
                if s[l-1]==t:
                    l-=1
        else:
            if l>=0:
                if s[l]==t:
                    l+=1
            if r<=n-2:
                if s[r+1]==t:
                    r+=1
    print(r-l+1)
main()