Well, the series which Stepan watched for a very long time, ended. In total, the series had n episodes. For each of them, Stepan remembers either that he definitely has watched it, or that he definitely hasn't watched it, or he is unsure, has he watched this episode or not. 

Stepan's dissatisfaction is the maximum number of consecutive series that Stepan did not watch.

Your task is to determine according to Stepan's memories if his dissatisfaction could be exactly equal to k.


-----Input-----

The first line contains two integers n and k (1 ≤ n ≤ 100, 0 ≤ k ≤ n) — the number of episodes in the series and the dissatisfaction which should be checked. 

The second line contains the sequence which consists of n symbols "Y", "N" and "?". If the i-th symbol equals "Y", Stepan remembers that he has watched the episode number i. If the i-th symbol equals "N", Stepan remembers that he hasn't watched the epizode number i. If the i-th symbol equals "?", Stepan doesn't exactly remember if he has watched the episode number i or not.


-----Output-----

If Stepan's dissatisfaction can be exactly equal to k, then print "YES" (without qoutes). Otherwise print "NO" (without qoutes).


-----Examples-----
Input
5 2
NYNNY

Output
YES

Input
6 1
????NN

Output
NO



-----Note-----

In the first test Stepan remembers about all the episodes whether he has watched them or not. His dissatisfaction is 2, because he hasn't watch two episodes in a row — the episode number 3 and the episode number 4. The answer is "YES", because k = 2.

In the second test k = 1, Stepan's dissatisfaction is greater than or equal to 2 (because he remembers that he hasn't watch at least two episodes in a row — number 5 and number 6), even if he has watched the episodes from the first to the fourth, inclusive.

Difficulty: HARD
Tags: Dynamic programming
Skill types: Dynamic programming

Starter code:

Solutions:
import sys
(n, k) = list(map(int, input().split(' ')))
s = input()

def max_streak(s):
	result = 0
	for i in range(len(s)):
		j = i
		while j < len(s) and s[j] == 'N':
			j += 1
		result = max(result, j - i)
	return result
for i in range(n - k + 1):
	cur = list(s)
	for j in range(i, i + k):
		if cur[j] == '?':
			cur[j] = 'N'
	for j in range(i):
		if cur[j] == '?':
			cur[j] = 'Y'
	for j in range(i + k, n):
		if cur[j] == '?':
			cur[j] = 'Y'
	if max_streak(cur) == k:
		print('YES')
		return
print('NO')


(n, k) = map(int, input().split())
k = int(k)
s = input()
s = 'Y' + s + 'Y'
res = 'NO'
cnt = 0
can = True
for ch in s:
	if ch == 'N':
		cnt += 1
		if cnt > k:
			can = False
	else:
		cnt = 0
for i in range(1, n + 1):
	if i + k - 2 < n:
		subs = s[i:i + k]
		flag = True
		for ch in subs:
			if not ch in 'N?':
				flag = False
		if (s[i - 1] in 'Y?' and s[i + k] in 'Y?') and flag:
			res = 'YES'
if can:
	print(res)
else:
	print('NO')


def process(S, k):
	n = len(S)
	if k > n:
		return 'NO'
	current = 0
	for i in range(n):
		if S[i] == 'N':
			current += 1
			if current > k:
				return 'NO'
		else:
			current = 0
	start_work = True
	for i in range(k):
		if S[i] == 'Y':
			start_work = False
	if start_work and (k == n or (k < n and S[k] != 'N')):
		return 'YES'
	if n == 1:
		if k == 1 and S[0] in ['?N']:
			return 'YES'
		if k == 0 and S[0] in ['?Y']:
			return 'YES'
		return 'NO'
	if k == n:
		if 'Y' in S:
			return 'NO'
		return 'YES'
	Y_count = 0
	p1 = 0
	for i in range(1, k + 1):
		if S[i] == 'Y':
			Y_count += 1
	p2 = i
	for i in range(k + 1, n):
		if Y_count == 0 and S[p1] != 'N' and (p2 == n - 1 or S[p2 + 1] != 'N'):
			return 'YES'
		p1 += 1
		p2 += 1
		if p2 < n and S[p2] == 'Y':
			Y_count += 1
		if p1 < n and S[p1] == 'Y':
			Y_count -= 1
	if Y_count == 0 and p1 < n and (S[p1] != 'N'):
		return 'YES'
	return 'NO'
(n, k) = [int(x) for x in input().split()]
S = input()
print(process(S, k))


(n, k) = map(int, input().split())
s = list(input())
ans = False
for i in range(len(s) - k + 1):
	flag = True
	for j in range(i, i + k):
		if s[j] == 'Y':
			flag = False
			break
	if i + k < len(s) and s[i + k] == 'N':
		flag = False
	if i > 0 and s[i - 1] == 'N':
		flag = False
	if flag:
		ans = True
		break
maximum = 0
i = 0
while i < len(s):
	now = 0
	while s[i] != 'N':
		i += 1
		if i >= len(s):
			break
	if i >= len(s):
		break
	while i < len(s) and s[i] == 'N':
		i += 1
		now += 1
	maximum = max(maximum, now)
if ans and maximum <= k:
	print('YES')
else:
	print('NO')


(n, k) = list(map(int, input().split()))
s = input()
(cnt, mx) = (0, 0)
for i in range(n):
	if s[i] == 'N':
		cnt += 1
	else:
		cnt = 0
	mx = max(mx, cnt)
if mx > k:
	print('NO\n')
	return
for r in range(k, n + 1):
	l = r - k
	if l > 0 and s[l - 1] == 'N':
		continue
	if r < n and s[r] == 'N':
		continue
	bad = False
	for i in range(l, r):
		if s[i] == 'Y':
			bad = True
			break
	if not bad:
		print('YES\n')
		return
print('NO\n')


def calc(s):
	max_len = 0
	cur_len = 0
	for i in range(len(s)):
		if s[i] == 'N':
			cur_len += 1
		else:
			cur_len = 0
		max_len = max(max_len, cur_len)
	return max_len
(n, k) = list(map(int, input().split()))
s = input()
if calc(s) > k:
	print('NO')
	return
start = 0
while start + k - 1 < len(s):
	good = True
	for i in range(start, start + k):
		if s[i] == 'Y':
			good = False
			break
	if start - 1 >= 0 and s[start - 1] == 'N':
		good = False
	if start + k < len(s) and s[start + k] == 'N':
		good = False
	if good:
		print('YES')
		return
	start += 1
print('NO')


(n, m) = list(map(int, input().split()))
s = input()
cnt = int(0)
for ch in s:
	if ch == 'N':
		cnt += 1
	elif cnt > m:
		print('NO')
		exit(0)
	else:
		cnt = int(0)
if cnt > m:
	print('NO')
	exit(0)
s = 'Y' + s
for i in range(0, n + 1):
	if s[i] == '?' or s[i] == 'Y':
		cnt = int(0)
		for j in range(i + 1, n + 1):
			if s[j] == 'Y':
				if cnt == m:
					print('YES')
					exit(0)
				break
			if s[j] == '?':
				if cnt == m:
					print('YES')
					exit(0)
			cnt += 1
		if cnt == m:
			print('YES')
			exit(0)
print('NO')


(n, k) = map(int, input().split())
string = input()
series = []
now = ''
for elem in string:
	if elem == 'Y':
		if now:
			series.append(now)
		now = ''
	else:
		now += elem
if now:
	series.append(now)
answer = False
no_max = True
if not k:
	for elem in series:
		if elem.count('N'):
			answer = True
	print('YES' if not answer else 'NO')
else:
	for elem in series:
		m = len(elem)
		for i in range(m - k + 1):
			if (not i or elem[i - 1] == '?') and (i + k - 1 == m - 1 or elem[i + k] == '?'):
				answer = True
		counter = 0
		for letter in elem:
			if letter == 'N':
				counter += 1
				if counter > k:
					no_max = False
			else:
				counter = 0
	print('YES' if answer and no_max else 'NO')


import sys
(n, k) = map(int, input().split())
s = input()
dp = [-1 for i in range(n + 1)]
count = 0
mxcount = 0
for i in s:
	if i == 'N':
		count += 1
	else:
		if mxcount < count:
			mxcount = count
		count = 0
if mxcount < count:
	mxcount = count
status = 0
if mxcount > k:
	print('NO')
	status = 1
elif mxcount == k:
	print('YES')
else:
	s = s + 'Y'
	for i in range(k, n + 1):
		if s[i] != 'N' and s[i - k - 1] != 'N':
			temp = False
			for j in range(i - k, i):
				if s[j] == 'Y':
					temp = True
					break
			if not temp:
				print('YES')
				exit()
	print('NO')


from sys import stdin
from functools import lru_cache
from collections import defaultdict
infile = stdin
(N, K) = map(int, infile.readline().split())
watched = infile.readline().strip()
mem = set()
mem.add((0, 0, 0))
for (i, letter) in enumerate(watched):
	for d in range(K + 1):
		for c in range(K + 1):
			if (i, d, c) in mem:
				if letter in ('N', '?'):
					mem.add((i + 1, max(d, c + 1), c + 1))
				if letter in ('Y', '?'):
					mem.add((i + 1, d, 0))

def good():
	for (i, d, c) in mem:
		if i == N and d == K:
			return 'YES'
	return 'NO'
print(good())