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


def main():
  _, Q = map(int, input().split())
  chars = input().strip()
  moves = [input().split() for _ in range(Q)]
  left = -1
  right = len(chars)

  for t, d in moves[::-1]:
    if left >= right:
      break

    if chars[left + 1] == t and d == 'L':
      left += 1

    if left >= 0 and chars[left] == t and 'R':
      left -= 1

    if chars[right - 1] == t and d == 'R':
      right -= 1

    if right < len(chars) and chars[right] == t and d == 'L':
      right += 1

  print(max(right - left - 1, 0))


if __name__ == '__main__':
  main()

