#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

signed 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++) cin >> t[i] >> d[i];

    int l = 0;
    int r = n;
    for(int i = q - 1; i >= 0; i--){

        //cout << l << " " << r << endl;
        if(d[i] == 'R'){
            if(s[r - 1] == t[i]) r--;
            if(l != 0 && s[l - 1] == t[i]) l--;
        }else{
            if(s[l] == t[i]) l++;
            if(r != n && s[r] == t[i]) r++;
        }
    }

    //cout << l << " " << r << endl;
    cout << max(0LL, r - l) << endl;
    return 0;
}