#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LI()
    if a == b and b == c:
        print("Yes")
    else:
        print("No")
    return

#B
def B():
    n = II()
    s = S()
    if s.count("R") > s.count("B"):
        print("Yes")
    else:
        print("No")
    return

#C
def C():
    n, q = LI()
    s = S()
    s.insert(0, "AA")
    s.append("AA")
    td = LSR(q)
    left = 1
    right = n
    td = td[::-1]
    ansleft = 1
    ansright = n
    # Left
    for td_ in td:
        t = td_[0][0]
        d = td_[1][0]
        if t == s[left] and d == "L":
            left += 1
        elif t == s[left-1] and d == "R":
            left -= 1
        ansleft = max(ansleft, left)
    # Right
    for td_ in td:
        t = td_[0][0]
        d = td_[1][0]
        #print(ansleft, right,s)
        if t == s[right] and d == "R":
            right -= 1
            #print()
        elif t == s[right+1] and d == "L":
            right += 1
        ansright = min(ansright, right)
        #print(ansleft,ansright)
    if ansright < ansleft:
        print(0)
        return
    print(n-(ansleft-1)-(n-ansright))   
    return

#D
def D():
    n, xb = LI()
    s = LI()
    a = list(itertools.permutations(range(n), n))
    ans = 0
    ss = min(s)
    for a_ in a:
        x = xb
        for aa in a_:
            #print(x,s[aa],x%s[aa],end=" : ",)
            x = x % s[aa]
            if x < ss:
                break
            elif x == ss:
                x = 0
                break
        #print(a_, x)
        ans += x % mod
    print(ans % mod)

    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    C()
