#こんなんか？
def 解():
    import sys
    input = sys.stdin.readline
    N,Q = [int(_) for _ in input().split()]
    S = " " + input() + " "
    aC = [[ _.rstrip() for _ in  _.split()] for _ in sys.stdin.readlines()]
    iL = 0
    iR = N+1
    for t,d in aC[::-1]:
        if t == S[iL+1] and d == "L":
            if iL < N+1:
                iL += 1
        if t == S[iR-1] and d == "R":
            if 0 < iR :
                iR -= 1
    if iL < iR:
        print(iR-iL-1)
    else:
        print(0)
解()
