#include <string>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N, Q;
	cin >> N >> Q;
	string s;
	cin >> s;
	vector<char> t(Q);
	vector<char> d(Q);
	for(int i = 0; i < Q; i += 1)
	{
		cin >> t[i] >> d[i];
	}

	int left = 0, right = N - 1;
	for(int i = Q - 1; i >= 0; i -= 1)
	{
		if(s[left] == t[i] && d[i] == 'L')
		{
			left += 1;
		}
		else if(s[right] == t[i] && d[i] == 'R')
		{
			right -= 1;
		}

		if(s[left - 1] == t[i] && d[i] == 'R')
		{
			left -= 1;
		}
		else if(s[right + 1] == t[i] && d[i] == 'L')
		{
			right += 1;
		}

		if(left > right)
			break;
	}

	std::cout << std::to_string(right - left + 1) << std::endl;
	return 0;
}