from sys import stdin
import math
import itertools
import copy


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def make_map(string):
    _dict = {}
    for i, t in enumerate(string):
        if not t in _dict:
            _dict[t] = [i]
        else:
            _dict[t].append(i)
    return _dict


def move(array, v_list):
    for dirc, i in v_list:
        com_cnt = array[i]
        #print(com_cnt, i)
        if com_cnt > 0:
            #print(com_cnt)
            #array[i][com] = 0
            array[i] = 0
            if dirc == 'L':
                if i > 0:
                    array[i-1] += com_cnt 
            if dirc == 'R':
                if i < len(array)-1:
                    array[i+1] += com_cnt
        #print(com, dirc)
        #print(array)
        #print(array)
    return array 


def solve(input_string):
    N, Q = input_string[0].rstrip().split()
    com_dict = make_map(input_string[1].rstrip())
    com_dirc_matrix = makeStringMatrix(input_string[2:])
    g_array = [1 for i in range(int(N))]
    v_list = []
    for com, dirc in com_dirc_matrix:
        if com in com_dict:
            for i in com_dict[com]: 
                v_list.append((dirc, i))
    #print(v_list)
    g_array = move(g_array, v_list)
    _sum  = sum(g_array)
    return _sum


def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()
