N, Q = map(int, input().split())
s = input()
queries = []
for _ in range(Q):
    t, d = input().split()
    queries.append((t, d))

mp = {}
for c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
    mp[c] = []

for i in range(N):
    c = s[i]
    mp[c].append(i)

idx_left = 0
idx_right = N - 1
for t, d in queries[::-1]:
    if d == 'L':
        if mp[t] != [] and mp[t][0] == idx_left:
            idx_left += 1
            del mp[t][0]
    if d == 'R':
        if mp[t] != [] and mp[t][-1] == idx_right:
            idx_right -= 1
            del mp[t][-1]
    if idx_left > idx_right:
        print(0)
        exit(0)

print(idx_right - idx_left + 1)

# disappear = [False for _ in range(N)]
# left_out_found = False
# right_out_found = False
# for t, d in queries[::-1]:
#     if left_out_found