#include <iostream>
#include <vector>
#include <map>

using namespace std;

struct M {
	char t, d;
};

int main() {
	long long n, q;
	cin >> n >> q;
	
	string s;
	cin >> s;
	
	vector<M> m(q);
	for (auto &&e : m) {
		cin >> e.t >> e.d;
	}
	
	long long lCount = 0, rCount = 0;
	for (long long i = q - 1; i >= 0; --i) {
//		cout << m[i].t << " " << m[i].d << endl;
		if (m[i].d == 'L') {
			if (s[lCount] == m[i].t) {
				++lCount;
//				cout << "++L" << endl;
			}
			
			if (rCount && s[n - rCount] == m[i].t) {
				--rCount;
			}
		} else {
			if (s[n - 1 - rCount] == m[i].t) {
				++rCount;
//				cout << "++R" << endl;
			}
		
			if (lCount && s[lCount - 1] == m[i].t) {
				--lCount;
			}
		}
	}
	
	cout << n - (lCount + rCount) << endl;
}