#
import sys
import math
import numpy as np
import itertools

# いくつか入力
n,q = (int(i) for i in input().split())  
# 文字列をリストに
s = list(input())

# n行複数列の数をリストに
td = [[i for i in input().split()] for i in range(q)] 


hidari = 0
migi   = n-1

for i in range(q-1,-1,-1):
    if td[i][0] == s[hidari] and td[i][1] == 'L':
        hidari += 1
        if hidari == n:
            print("0")
            exit()
    elif hidari >0:
        if td[i][0] == s[hidari-1] and td[i][1] == 'R':
            hidari -= 1

for i in range(q-1,-1,-1):
    if td[i][0] == s[migi] and td[i][1] == 'R':
        migi -= 1
        if migi == -1:
            print("0")
            exit()
    elif migi <n-1:
        if td[i][0] == s[migi+1] and td[i][1] == 'L':
            hidari += 1

if migi <= hidari:
    print("0")
else:
    print(migi-hidari+1)

#print(migi,hidari)

