def main():
    N,Q=map(int, input().split())
    S=input()
    TD=[tuple(input().split()) for _ in range(Q)]
    l=0
    r=N-1
    for t,d in TD[::-1]:
        if d=="L" and S[l]==t:
            l+=1
        if d=="R" and S[r]==t:
            r-=1
        if l>r:
            break
    print(-l+r+1)

if __name__ == "__main__":
    main()