#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
 
int main()
{
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    s.insert(s.begin(), '?');
    s.push_back('?');
    char t[200006], d[200006];
    for(int i = 1; i <= q; i++){
        cin >> t[i] >> d[i];
    }
    int nr = n + 1;
    int nl = 0;
    for(int i = q; i > 0; i--){
        if(nr - nl == 1){
            cout << 0 << endl;
            return 0;
        }
        if(d[i] == 'R'){
            if(t[i] == s[nr - 1]){
                nr--;
            }
            if(t[i] == s[nl]){
                nl--;
            }
        }
        if(d[i] == 'L'){
            if(t[i] == s[nr]){
                nr++;
            }
            if(t[i] == s[nl + 1]){
                nl++;
            }
        }
    }
    cout << n - nl - (n - nr + 1) << endl;
}