#! /usr/bin/env python
# -*- coding: utf-8 -*-

def SearchIdx(s, c):
    idx = []
    for i in range(0,len(s)):
        if(s[i] == c):
            idx.append(i)
    return idx
if __name__ == '__main__':
    N, Q = map(int, input().split()) # N, Q for number
    sN = list(input())
    golems = []
    for i in range(0,N): # init golem
        golems.append({'id':i, 'loc': i, 'location': sN[i]})

    sQ = []
    for i in range(0, Q):
        t, d = input().split()
        sQ.append({'t': t, 'd': d})
    for q in sQ: # loop to handle Q
        for g in golems:
            if(g['loc'] >= 0 and sN[g['loc']] == q['t']):
                if(q['d'] == 'L'):
                    if(g['loc'] <= 0):
                        g['loc'] = -1
                        g['location'] = ''
                    else:
                        g['loc'] = g['loc'] -1
                        g['location'] = sN[g['loc']]
                elif(q['d'] == 'R'):
                    if(g['loc'] >= N -1):
                        g['loc'] = -1
                        g['location'] = ''
                    else:
                        g['loc'] = g['loc'] + 1
                        g['location'] = sN[g['loc']]

    remain = len(golems)
    for g in golems:
        if(g['loc'] == -1):
            remain = remain - 1

    print(remain)