#!/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:
      print('0')
      return

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

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

  print(right - left - 1)


if __name__ == '__main__':
  main()

