n,m=map(int,input().split()) s=input() w=[] a=[] c=[] for i,j in enumerate(s): if j=='W': w.append(i) elif j=='A': a.append(i) else : c.append(i) ok=1 for i in range(m): ok&=(a[i]