# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n, q = LI()
    S = SI()

    B = [LS() for _ in range(q)]
    l, r = 0, n - 1
    ls, rs = '@', '@'
    cl, cr = 0, 0
    for t, d in B[::-1]:
        if d == 'L':
            if t == S[l]:
                cl = l + 1
                l += 1
                ls = t
            if rs == t:
                cr -= 1

        else:
            if t == S[r]:
                cr = n - r
                r -= 1
                rs = t
            if ls == t:
                cl -= 1
        if l >= n or r < 0:
            return 0

    return max(0, n - cl - cr)


print(main())
