#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,Q;
    string S;
    cin >> N >> Q >> S;
    int used[N] = {};    
    int l = 0,r = N-1;
    vector<char> T(Q),D(Q);
    rep(i,0,Q){
        cin >> T[i] >> D[i];
    }
    reverse(T.begin(), T.end());
    reverse(D.begin(), D.end());
    //cout << endl;
    rep(i,0,Q){
        //cout << T[i] << " " << D[i] << endl;
        if(D[i] == 'L'){
            if(S[l] == T[i]){
                used[l] = 1;
                l = l == N-1 ? l : l + 1;
            }
            if(S[r] == T[i]){
                used[r] = 0;
                r = r == N-1 ? r : r + 1;
            }
        }else{
            if(S[r] == T[i]){
                used[r] = 1;
                r = r == 0 ? r : r - 1;
            }
            if(S[l] == T[i]){
                used[l] = 0;
                l = l == 0 ? l : l - 1;
            }
        }
    }
    int cnt = N;
    rep(i,0,N)cnt -= used[i];
    //rep(i,0,N)cout << used[i] << " ";cout << endl;
    cout << cnt << endl;
}