import Data.Vector.Unboxed ((!))
import qualified Data.Vector.Unboxed as V
import Control.Monad

main = do
  [n,q]<-map read.words<$>getLine
  s<-getLine
  ops<-replicateM q$(\[a,b]->(a,b)).map head.words<$>getLine
  print $ solve n s ops

solve n s ops = right - left
  where
  right = findBorder surviveR n
  left  = findBorder (not.surviveL) n
  surviveR = f ops
  f [] _ = True
  f ((t,'L'):ops) pos = if golems!pos == t then pos==0 || f ops (pos-1) else f ops pos
  f ((t,'R'):ops) pos = if golems!pos == t then pos/=n-1 && f ops (pos+1) else f ops pos
  surviveL = g ops
  g [] _ = True
  g ((t,'R'):ops) pos = if golems!pos == t then pos==n-1 || g ops (pos+1) else g ops pos
  g ((t,'L'):ops) pos = if golems!pos == t then pos/=0 && g ops (pos-1) else g ops pos
  golems = V.fromListN n s

findBorder f = go (-1)
  where
  go l r
    | l+1 == r = l
    | f m = go m r
    | otherwise = go l m
    where m = (l+r) `div` 2