#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef long long ll;

const int maxn = 202000;
int n, q, lb, rb;
char s[maxn], t[maxn], d[maxn];

int main() {
    scanf("%d %d\n%s\n", &n, &q, s + 1);
    lb = 0, rb = n + 1; // (lb, rb) available
    rep(i, q) scanf("%c %c\n", &t[i], &d[i]);

    for(int i = q; i ; --i) {
        if(s[lb+1]==t[i] && d[i]=='L') lb++;
        if(s[rb-1]==t[i] && d[i]=='R') rb--;

        if(s[lb]==t[i] && d[i]=='R') lb--;
        if(s[rb]==t[i] && d[i]=='L') rb++;
    }

    printf("%d\n", rb - lb - 1);

    return 0;
}