r, b = map(int, input().split()) rgw = input() d = list(rgw) i = 0 while(1): if i >= len(d): break if d[i] == 'R': while(len(d)> i + r and d[i + r] == 'R'): del(d[i + r]) if d[i] == 'B': while(len(d)> i + b and d[i + b] == 'B'): del(d[i + b]) i += 1 print(len(d))