import Control.Monad
import Data.Array
import Data.List
main = do
  [n,q] <- map read . words <$> getLine
  s <- listArray (1,n) <$> getLine
  tds <- replicateM q $ do
    [[t],[d]] <- words <$> getLine
    return (t,d)
  print . length . filter (/= 0) $ map (\p -> foldl' (move s n) p tds) [1..n]

move _ _ 0 _ = 0
move s n p (t,d) | (s ! p) == t = if d == 'R' then (p+1) `mod` (n+1) else (p-1) `mod` (n+1)
move _ _ p _ = p