MOD = 998244353 N, K = map(int, input().split()) S = ['P'] + list(input()) max_plan = S.count('N') - K # dp[i][j]: i日目までに予定をj個入れる入れ方 dp = [[0]*(max_plan + 1) for _ in range(N+1)] dp[0][0] = 1 for i in range(1, N+1): if S[i] != 'N' or S[i-1] == 'C': for j in range(max_plan + 1): dp[i][j] = dp[i-1][j] continue dp[i][0] = dp[i-1][0] for j in range(1, max_plan + 1): dp[i][j] += dp[i-1][j] dp[i][j] += dp[i-1][j-1] print(sum(dp[N][j] for j in range(1, max_plan + 1)))