Kawashiro Nitori is a girl who loves competitive programming.

One day she found a string and an integer. As an advanced problem setter, she quickly thought of a problem.

Given a string $s$ and a parameter $k$, you need to check if there exist $k+1$ non-empty strings $a_1,a_2...,a_{k+1}$, such that $$s=a_1+a_2+\ldots +a_k+a_{k+1}+R(a_k)+R(a_{k-1})+\ldots+R(a_{1}).$$

Here $+$ represents concatenation. We define $R(x)$ as a reversed string $x$. For example $R(abcd) = dcba$. Note that in the formula above the part $R(a_{k+1})$ is intentionally skipped.


-----Input-----

The input consists of multiple test cases. The first line contains a single integer $t$ ($1\le t\le 100$)  — the number of test cases. The description of the test cases follows.

The first line of each test case description contains two integers $n$, $k$ ($1\le n\le 100$, $0\le k\le \lfloor \frac{n}{2} \rfloor$)  — the length of the string $s$ and the parameter $k$.

The second line of each test case description contains a single string $s$ of length $n$, consisting of lowercase English letters.


-----Output-----

For each test case, print "YES" (without quotes), if it is possible to find $a_1,a_2,\ldots,a_{k+1}$, and "NO" (without quotes) otherwise.

You can print letters in any case (upper or lower).


-----Examples-----

Input
7
5 1
qwqwq
2 1
ab
3 1
ioi
4 2
icpc
22 0
dokidokiliteratureclub
19 8
imteamshanghaialice
6 3
aaaaaa
Output
YES
NO
YES
NO
YES
NO
NO


-----Note-----

In the first test case, one possible solution is $a_1=qw$ and $a_2=q$.

In the third test case, one possible solution is $a_1=i$ and $a_2=o$.

In the fifth test case, one possible solution is $a_1=dokidokiliteratureclub$.

Source: codeforces | Difficulty: EASY
Tags: Greedy algorithms

String algorithms

Complete search

Constructive algorithms


Solutions:
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	c = 0
	f = 0
	for i in range(0, n // 2):
		if s[i] == s[n - i - 1]:
			c += 1
		else:
			break
	if c > k:
		print('YES')
	elif c == k:
		if n % 2 != 0:
			print('YES')
		elif s == s[::-1]:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


def solve():
	(n, k) = list(map(int, input().split()))
	s = input()
	if n < k * 2 + 1:
		print('NO')
		return
	if k == 0:
		print('YES')
		return
	for i in range(k):
		if s[i] != s[n - i - 1]:
			print('NO')
			return
	print('YES')
for _ in range(int(input())):
	solve()


import math
from collections import defaultdict
from sys import stdin
T = int(input())
for _ in range(T):
	(n, op) = map(int, input().split())
	s = input()
	if op == 0:
		print('YES')
		continue
	(i, j) = (0, n - 1)
	f = 1
	while op:
		if s[i] != s[j]:
			f = 0
			break
		op -= 1
		i += 1
		j -= 1
	if f:
		if i > j:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k) = [int(j) for j in input().split(' ')]
	s = input()
	if k == n / 2:
		print('NO')
		continue
	success = False
	for j in range(k, int(n / 2) + 1):
		if s[:j] == s[n - j:][::-1]:
			success = True
			break
	if success:
		print('YES')
	else:
		print('NO')


def solve(s, n, k):
	if k == 0:
		return True
	if n % 2 == 0 and k == n // 2:
		return False
	for i in range(k):
		if s[i] != s[n - 1 - i]:
			return False
	return True
t = int(input())
for tc in range(t):
	(n, k) = map(int, input().split())
	s = input()
	result = solve(s, n, k)
	print('YES' if result else 'NO')


def reverse(s):
	sl = list(s)
	slr = []
	for i in range(len(sl) - 1, -1, -1):
		slr.append(sl[i])
	sr = ''.join(slr)
	return sr

def answer(n, k, s):
	if k == 0:
		return 'YES'
	if n < 2 * k + 1:
		return 'NO'
	sr = reverse(s)
	print(s, sr)
	if s == sr:
		return 'YES'
	else:
		return 'NO'

def answer2(n, k, s):
	if k == 0:
		return 'YES'
	if n < 2 * k + 1:
		return 'NO'
	for i in range(k):
		if s[i] != s[-(i + 1)]:
			return 'NO'
	return 'YES'

def main():
	t = int(input())
	n = [0] * t
	k = [0] * t
	s = [0] * t
	for j in range(t):
		(n[j], k[j]) = [int(i) for i in input().split()]
		s[j] = input()
	for j in range(t):
		print(answer2(n[j], k[j], s[j]))
main()


from sys import stdin as si, stdout as so
for _ in range(int(si.readline())):
	(n, k) = map(int, si.readline().split())
	s = si.readline().strip()
	if k == 0:
		so.write('YES\n')
		continue
	if 2 * k == n:
		so.write('NO\n')
		continue
	t = True
	for i in range(k):
		if s[i] != s[n - 1 - i]:
			t = False
	if t:
		so.write('YES\n')
	else:
		so.write('NO\n')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()

	def helper(s, n, k):
		if k == 0:
			return 'YES'
		elif n <= 2 * k:
			return 'NO'
		elif s[:k] == s[-k:][::-1]:
			return 'YES'
		else:
			return 'NO'
	print(helper(s, n, k))


import sys
t = int(input())
for i1 in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	s = input()
	if k == 0:
		print('YES')
	elif n < 2 * k + 1:
		print('NO')
	else:
		flag = 1
		s1 = ''.join(reversed(s))
		for i in range(k):
			if s[i] != s1[i]:
				flag = 0
				print('NO')
				break
		if flag == 1:
			print('YES')


for _ in range(int(input())):
	(x, k) = map(int, input().split())
	s = input()
	n = len(s)
	if n <= 2 * k:
		print('no')
	else:
		f = 0
		A = s[::-1]
		for i in range(k):
			if A[i] == s[i]:
				continue
			else:
				print('no')
				f = 1
				break
		if f != 1:
			print('yes')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	st = input()
	fl = 0
	for i in range(k):
		if st[i] != st[-i - 1]:
			fl = 1
			break
	if k == n / 2:
		fl = 1
	if fl == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	s = input()
	if k == 0:
		print('YES')
		continue
	if k > n // 2 and n % 2 != 0:
		print('NO')
		continue
	if k > n // 2 - 1 and n % 2 == 0:
		print('NO')
		continue
	if n % 2 == 0:
		it = n // 2 - 1
	else:
		it = n // 2
	flg = False
	kt = 0
	for i in range(it):
		if s[i] != s[-i - 1]:
			flg = True
			break
		else:
			kt += 1
	if not flg:
		print('YES')
	elif kt >= k:
		print('YES')
	else:
		print('NO')


from math import ceil
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	t = s[:k] + s[n - k:n]
	if 2 * k != n and (k == 0 or t == t[::-1]):
		print('YES')
	else:
		print('NO')


def validate(s, n, k):
	(i, j) = (0, n - 1)
	while i < k:
		if s[i] != s[j]:
			return False
		i += 1
		j -= 1
	if j - i >= 0:
		return True
	else:
		return False
tc = int(input())
for _ in range(tc):
	(n, k) = map(int, input().split())
	s = input()
	if validate(s, n, k):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	sr = s[::-1]
	c = 0
	m = (n + 1) // 2 - 1
	for i in range(m):
		if s[i] == sr[i]:
			c += 1
		else:
			break
	if c >= k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	S = input()
	print()
	if k == 0:
		print('YES')
		continue
	elif S[:k] == S[::-1][:k]:
		if n // 2 >= k + 1 - n % 2:
			print('YES')
			continue
	print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	a = input()
	if k * 2 + 1 <= n and a[n - k:][::-1] == a[:k]:
		print('YES')
	else:
		print('NO')


def solve(n, k, s):
	if n % 2 == 0:
		x = n // 2 - 1
		if k > x:
			return 'NO'
		i = 0
		j = n - 1
		y = 0
		while i < j:
			if y == k:
				return 'YES'
			if s[i] != s[j]:
				return 'NO'
			y += 1
			j -= 1
			i += 1
		return 'YES'
	else:
		x = n // 2
		if k > x:
			return 'NO'
		i = 0
		j = n - 1
		y = 0
		while i < j:
			if y == k:
				return 'YES'
			if s[i] != s[j]:
				return 'NO'
			y += 1
			j -= 1
			i += 1
		return 'YES'
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split(' '))
	s = input()
	print(solve(n, k, s))


for i in range(int(input())):
	(x, y) = map(int, input().split())
	s = input()
	if y == 0 or (s[:y] == s[-y:][::-1] and x >= y * 2 + 1):
		print('YES')
	else:
		print('NO')


xn = int(input())
for _ in range(xn):
	(nn, kn) = map(int, input().split())
	str2n = input()
	for l in range(1, 20):
		continue
	if kn == 0:
		print('YES')
		continue
	if 2 * kn + 1 > nn:
		print('NO')
	else:
		inn = 0
		jn = nn - 1
		for m in range(1, 20):
			continue
		while inn < jn and str2n[inn] == str2n[jn]:
			inn += 1
			jn -= 1
		if inn >= kn:
			print('YES')
		else:
			print('NO')


from collections import Counter
for gg in range(int(input())):
	(n, k) = list(map(int, input().split()))
	s = input()
	count = Counter(s)
	if k == 0:
		print('YES')
	elif s[0:k] == s[n - 1:n - k - 1:-1] and k * 2 != n:
		print('YES')
	else:
		print('NO')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect, insort
from time import perf_counter
from fractions import Fraction
import copy
from copy import deepcopy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
for _ in range(L()[0]):
	(n, k) = L()
	s = input()
	if k == 0:
		print('YES')
		continue
	ans = 0
	for i in range(k):
		if s[i] != s[-i - 1]:
			ans = 1
			break
	if ans == 0 and i == n // 2 - 1 and (n % 2 == 0):
		ans = 1
	print(['YES', 'NO'][ans])
endtime = time.time()


def fun(s, k):
	for i in range(k):
		if s[i] != s[n - i - 1]:
			return False
	return True
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input().rstrip()
	if 2 * k + 1 > n:
		print('NO')
	elif fun(s, k):
		print('YES')
	else:
		print('NO')


t = int(input().strip())
for _ in range(t):
	(n, k) = map(int, input().strip().split())
	s = input().strip()
	if s[:k] == s[:-k - 1:-1] and len(s) > 2 * k:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	mp = {}
	s = input()
	boo = True
	i = 0
	j = len(s) - 1
	val = 0
	while i < j:
		if s[i] != s[j]:
			break
		else:
			val += 1
		i += 1
		j -= 1
	if val >= k and 2 * k != len(s):
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for t_itr in range(t):
		(n, k) = map(int, input().split())
		s = input().strip()
		k1 = k
		ans = 'YES'
		for i in range(0, n // 2):
			if s[i] != s[n - i - 1]:
				break
			else:
				k1 = k1 - 1
		if n == 2 * k or k1 > 0:
			print('NO')
		else:
			print('YES')
main()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if n > 2 * k and s[:k][::-1] == s[n - k:]:
		print('YES')
	elif k == 0 and n > 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	a = list(input())
	if m * 2 == n:
		print('NO')
		continue
	for i in range(m):
		if a[i] != a[-(i + 1)]:
			print('NO')
			break
	else:
		print('YES')


import sys
import math
from math import factorial, inf, gcd
from heapq import *
from functools import *
from itertools import *
from collections import *
from typing import *
sys.setrecursionlimit(10 ** 5)
t = 1
t = int(input())
for ii in range(t):
	(n, k) = (int(i) for i in input().split())
	s = input()
	(i, j) = (0, len(s) - 1)
	while i + 1 < j and s[i] == s[j]:
		i += 1
		j -= 1
	print('YES' if i >= k else 'NO')


def fun(n, m, s):
	flag = 1
	for i in range(m):
		if s[i] != s[n - i - 1]:
			flag = 0
	if m * 2 == n:
		flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')
t = int(input())
i = 0
while i < t:
	(n, m) = map(int, input().split())
	s = input()
	fun(n, m, s)
	i += 1


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()
inf = 10 ** 16
md = 10 ** 9 + 7

def ok():
	if n < 2 * k + 1:
		return False
	for i in range(k):
		if s[i] != s[n - 1 - i]:
			return False
	return True
for _ in range(II()):
	(n, k) = MI()
	s = SI()
	print('YES' if ok() else 'NO')


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
from queue import PriorityQueue as pq
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()[:-1]
	f = 0
	for i in range(k):
		if s[i] == s[n - i - 1]:
			continue
		else:
			f = 1
			break
	if f or 2 * k >= n:
		print('NO')
	else:
		print('YES')


def isPalin(s):
	return s == s[::-1]
for _ in range(int(input())):
	(n, k) = map(int, input().split(' '))
	s = input()
	if k == 0:
		ans = 'Yes'
	else:
		ans = 'Yes'
		for i in range(k):
			if s[i] != s[n - 1 - i]:
				ans = 'No'
				break
		if i + 1 == n - 1 - i:
			ans = 'No'
	print(ans)


from sys import stdin, stdout
from collections import Counter, OrderedDict, defaultdict
import math
import re
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(str(val) + ' ')
	cout('\n')

def binSearch(l, val, start, end):
	if end < start:
		return False
	mid = (start + end) // 2
	if l[mid] == val:
		return True
	elif l[mid] < val:
		return binSearch(l, val, mid + 1, end)
	elif l[mid] > val:
		return binSearch(l, val, start, mid - 1)

def myLog(x, y):
	z = int(math.log(x, y))
	if y ** (z + 1) > x:
		return z
	elif y ** (z + 1) == x:
		return z + 1
(t,) = mp()
for _ in range(t):
	(n, k) = mp()
	s = cin()[:n]
	x = s[-k:]
	if not k:
		cout('yes\n')
	elif n >= 2 * k + 1:
		if s[:k] == x[::-1]:
			cout('yes\n')
		else:
			cout('no\n')
	else:
		cout('no\n')


for _ in ' ' * int(input()):
	(n, k) = list(map(int, input().split()))
	s = input()
	print(('NO', 'YES')[k == 0 or (n >= 2 * k + 1 and s[:k] == s[-k:][::-1])])


for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if len(s) < 2 * k + 1:
		print('NO')
		continue
	l = 0
	r = len(s) - 1
	count = 0
	while l < r:
		if s[l] == s[r]:
			count += 1
			l += 1
			r -= 1
		else:
			break
	if count >= k:
		print('YES')
	else:
		print('NO')


from sys import stdout, stdin
input = stdin.readline
print = stdout.write

def main():
	mp = lambda : map(int, input().strip().split())
	it = int
	t = it(input())
	for _ in [0] * t:
		(n, k) = mp()
		s = input().strip()
		if k == 0:
			print('yes\n')
		elif k + 1 <= (n + 1) // 2:
			f = True
			for i in range(k):
				if s[i] != s[-1 - i]:
					f = False
					break
			if f:
				print('yes\n')
			else:
				print('no\n')
		else:
			print('no\n')
main()


import sys

def is_valid(n, k, s):
	if k == 0:
		return 'YES'
	elif k == n // 2 and n % 2 == 0:
		return 'NO'
	else:
		for i in range(k):
			if s[i] != s[-i - 1]:
				return 'NO'
		return 'YES'
t = int(sys.stdin.readline().rstrip())
for _ in range(t):
	(n, k) = list(map(int, sys.stdin.readline().rstrip().split()))
	s = sys.stdin.readline().rstrip()
	print(is_valid(n, k, s))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = input()
	if k * 2 == n:
		print('NO')
	else:
		temp1 = x[:k]
		temp2 = x[n - k:]
		temp2 = temp2[::-1]
		if temp1 == temp2:
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	[n, k] = (int(i) for i in input().split())
	s = input()
	fl = 0
	if n < 2 * k + 1:
		print('NO')
	else:
		for i in range(k):
			if s[i] != s[n - 1 - i]:
				print('NO')
				fl = 1
				break
		if fl == 0:
			print('YES')


import math

def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def msi():
	return map(str, input().split())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def lsi():
	return list(msi())
for _ in range(ii()):
	a = li()
	n = a[0]
	k = a[1]
	s = si()
	ans1 = ans2 = ''
	for i in range(0, k):
		ans1 += s[i]
		ans2 += s[n - i - 1]
	if ans1 == ans2 and 2 * k < n:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if n < 2 * k + 1:
		print('NO')
	else:
		(l, r) = (0, n - 1)
		ans = True
		for i in range(k):
			if s[l] != s[r]:
				ans = False
				break
			l += 1
			r -= 1
		if ans:
			print('YES')
		else:
			print('NO')


def check(s, n, k):
	if k == 0:
		return True
	if n <= 2:
		return False
	i = 0
	j = n - 1
	abets = 'abcdefghijklmnopqrstuvwxyz'
	d = dict(zip(abets, range(26)))
	forward = [0] * 26
	backward = [0] * 26
	times = 0
	prevfor = 0
	prevback = n
	while i < j:
		forward[d[s[i]]] += 1
		backward[d[s[j]]] += 1
		if forward == backward:
			temp1 = s[prevfor:i + 1]
			temp2 = s[j:prevback]
			if temp1 == temp2[::-1]:
				times += 1
				prevfor = i + 1
				prevback = j
			if times == k and i != j - 1:
				return True
		i += 1
		j -= 1
	return False
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if check(s, n, k):
		print('YES')
	else:
		print('NO')


for pratyush in range(int(input())):
	(n, k) = list(map(int, input().split()))
	s = input()
	if k == 0:
		print('YES')
	elif n == 2 * k:
		print('NO')
	else:
		a = s[:k]
		f = s[::-1]
		b = f[:k]
		if a == b:
			print('YES')
		else:
			print('NO')


def solve(s, n, k):
	if k == 0:
		return True
	if n <= 2 * k:
		return False
	count = 0
	start = 0
	end = n - 1
	while start <= end:
		if s[start] == s[end]:
			count += 1
			start += 1
			end -= 1
		else:
			break
	if count >= k:
		return True
	else:
		return False
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	if solve(s, n, k) is True:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if n > 2 * k:
		if k == 0:
			print('YES')
		else:
			cnt = 0
			z = n // 2
			if n % 2 == 0:
				z -= 1
			for i in range(z):
				if s[i] != s[n - i - 1]:
					cnt = 1
					break
				k -= 1
				if k == 0:
					break
			if cnt == 0:
				print('YES')
			else:
				print('NO')
	else:
		print('NO')


for k in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if k * 2 == n:
		print('NO')
	else:
		a = s[0:k]
		b = s[n - k:n]
		if a == b[::-1]:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	c = 0
	first = s[0:k]
	new = s[::-1]
	second = new[0:k]
	if first == second:
		if len(first) + len(second) < n:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if k == 0 or (s[:k] == ''.join(list(reversed(s[n - k:]))) and n // 2 + n % 2 >= k + 1):
		print('YES')
	else:
		print('NO')


def fun():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		s = input().strip()
		if k == 0:
			print('YES')
			continue
		if n == 2 * k:
			print('NO')
			continue
		(state, i, j) = (0, 0, n - 1)
		while i < j:
			if s[i] == s[j]:
				k -= 1
			else:
				break
			if k == 0:
				state = 1
				break
			i += 1
			j -= 1
		if state == 1:
			print('YES')
		else:
			print('NO')
fun()


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	str = input()
	for i in range(k + 1):
		if str[i] != str[n - 1 - i]:
			break
	if i < k:
		print('NO')
	elif i * 2 >= n:
		print('NO')
	else:
		print('YES')


I = input
exec(int(I()) * "n,k=map(int,I().split());s=I();print('YNEOS'[s[:k]!=s[:~k:-1]or 2*k==n::2]);")


def hel(s, k):
	i = 0
	j = len(s) - 1
	n = len(s)
	if k == 0:
		return True
	if n / 2 == k:
		return False
	c = 0
	while j > i:
		if s[i] == s[j]:
			c += 1
			i += 1
			j -= 1
		else:
			break
	if c >= k:
		return True
	else:
		return False
t = int(input())
for i in range(t):
	arr = list(map(int, input().split()))
	k = arr[1]
	s = input()
	if hel(s, k):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	a = s[::-1]
	cnt = 0
	if k == 0:
		print('YES')
		continue
	if k * 2 + 1 > n:
		print('NO')
		continue
	for i in range(k):
		if s[i] == a[i]:
			cnt += 1
	if cnt == k:
		print('YES')
	else:
		print('NO')


I = input
for _ in ' ' * int(I()):
	(n, k) = map(int, I().split())
	s = I()
	print('YNEOS'[2 * k == n or s[:k] != s[-1:-k - 1:-1]::2])


def is_pal(inp):
	m = True
	for i in range(0, len(inp) // 2):
		if inp[i] != inp[len(inp) - 1 - i]:
			m = False
			break
	return m
t = int(input())
for j in range(0, t):
	l1 = [int(x) for x in input().split()]
	n = l1[0]
	k = l1[1]
	inp = input()
	if k == 0:
		print('YES')
	elif k * 2 == n:
		print('NO')
	elif is_pal(inp[0:k] + inp[n - k:]) == True:
		print('YES')
	else:
		print('NO')


import sys
import math

def read_ints():
	inp = input().split()
	inp = [int(x) for x in inp]
	return inp

def read_strings():
	inp = input()
	s = [inp[i] for i in range(len(inp))]
	return s
t = int(input())
for _ in range(t):
	nk = read_ints()
	n = nk[0]
	k = nk[1]
	s = input()
	(i, j) = (0, len(s) - 1)
	c = 0
	while i < j:
		if s[i] == s[j]:
			c += 1
		else:
			break
		i += 1
		j -= 1
	ans = 'NO'
	if i < j:
		if c >= k:
			ans = 'YES'
	elif i == j:
		if c >= k:
			ans = 'YES'
	elif c > k:
		ans = 'YES'
	print(ans)


def answer(s, n, k):
	if 2 * k + 1 > n:
		return 'NO'
	for i in range(k):
		if s[i] != s[n - i - 1]:
			return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	[n, k] = list(map(int, input().split()))
	s = input()
	print(answer(s, n, k))


t = int(input())
for _ in range(t):
	ans = 0
	(n, k) = [int(x) for x in input().split()]
	s = input()
	tmp = s[:k] + s[n - k:]
	if tmp == tmp[::-1]:
		ans = 1
	if 2 * k == n:
		ans = 0
	if ans:
		print('YES')
	else:
		print('NO')


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_int():
	return int(input())

def get_ints():
	return list(map(int, input().split(' ')))

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().split(' ')

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a, drop_zero=False):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	if drop_zero:
		return p[1:]
	else:
		return p

def prefix_mins(a, drop_zero=False):
	p = [float('inf')]
	for x in a:
		p.append(min(p[-1], x))
	if drop_zero:
		return p[1:]
	else:
		return p

def solve_a():
	(n, k) = get_ints()
	s = input().strip()
	j = 0
	while j <= (n - 3) // 2 and s[j] == s[-(j + 1)]:
		j += 1
	return yes_no(k <= j)
t = get_int()
for _ in range(t):
	print(solve_a())


for i in range(int(input())):
	a = input()
	x = a.split()
	n = int(x[0])
	k = int(x[1])
	s = input()
	if n == 2 * k:
		print('no')
	else:
		f = 0
		for i in range(k):
			if s[i] != s[len(s) - 1 - i]:
				f = 1
				print('no')
				break
		if f == 0:
			print('yes')


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	s = input()
	(i, j) = (0, n - 1)
	c = 0
	while i <= j:
		if s[i] == s[j]:
			i = i + 1
			j = j - 1
			c = c + 1
		else:
			c = c + 1
			break
	if c >= k + 1:
		print('YES')
	else:
		print('NO')


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)

def number_to_list(a):
	b = []
	while a >= 1:
		c = a % 10
		a = int(a / 10)
		b.append(c)
	return list(reversed(b))

def str_list_to_int_list(a):
	a = list(map(int, a))
	return a

def make_1d_array(n, inti=0):
	a = [inti for _ in range(n)]
	return a

def make_2d_array(n, m, inti=0):
	a = [[inti for _ in range(m)] for _ in range(n)]
	return a

def make_3d_array(n, m, k, inti=0):
	a = [[[inti for _ in range(k)] for _ in range(m)] for _ in range(n)]
	return a

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input()))
(t,) = I()
for t1 in range(t):
	(n, k) = I()
	s = S()[:-1]
	if k == 0:
		print('YES')
	else:
		count = 0
		countx = 0
		if n % 2 == 0:
			n1 = n - 1
		else:
			n1 = n
		for i in range(int(n1 / 2)):
			if s[i] == s[n - i - 1]:
				count += 1
			else:
				countx = 1
				break
		if countx == 1:
			if count >= k:
				print('YES')
			else:
				print('NO')
		elif count >= k:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	string = input()
	i = 0
	result = 'YES'
	while i < k:
		if string[i] != string[-i - 1]:
			result = 'NO'
			break
		i = i + 1
	if k > 0:
		if n / k <= 2:
			result = 'NO'
	print(result)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	if 2 * k == n:
		print('NO')
		continue
	if k == 0:
		print('YES')
		continue
	if s[:k] == s[-k:][::-1]:
		print('YES')
	else:
		print('NO')


inn = lambda : int(input())
inm = lambda : map(int, input().split())
ins = lambda : str(input())
ina = lambda : list(map(int, input().split()))

def solve():
	(n, k) = inm()
	s = ins()
	t = s[n - k:][::-1]
	if s[:k] == t and k < n - k:
		print('YES')
	else:
		print('NO')

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
main()


t = int(input())
for i in range(0, t):
	(m, n) = map(int, input().split())
	s = input()
	ct = 0
	i = 0
	j = m - 1
	if m < 2 * n + 1:
		ct += 1
	else:
		for i in range(0, n):
			if s[i] != s[j]:
				ct += 1
				break
			i += 1
			j -= 1
	if ct == 0:
		print('YES')
	else:
		print('NO')


def solve():
	(n, k) = [int(x) for x in input().split()]
	s = input()
	if k == 0:
		print('YES')
		return
	else:
		distance = 1
		while distance < n - distance:
			if s[:distance] == s[n - distance:][::-1]:
				if len(s[:distance]) >= k:
					print('YES')
					return
			distance += 1
		print('NO')
		return
t = int(input())
for T in range(0, t):
	solve()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	string = [char for char in input()]
	count = 0
	output = 'YES'
	if k * 2 + 1 > n:
		output = 'NO'
	else:
		for i in range(k):
			if count >= k:
				break
			if string[i] == string[-1 * (i + 1)]:
				count += 1
			elif count < k:
				output = 'NO'
				break
	print(output)


import itertools
import bisect
import math
from collections import *
import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

def main():
	for _ in ' ' * int(input()):
		(n, k) = mii()
		s = li()
		ss = s[::-1]
		cnt = 0
		if k == 0:
			print('YES')
		else:
			for i in range(n // 2):
				if ss[i] == s[i]:
					cnt += 1
				else:
					break
			if k <= cnt:
				if n % 2 == 0:
					if k != n // 2:
						print('YES')
					else:
						print('NO')
				else:
					print('YES')
			else:
				print('NO')
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if n >= 2 * k + 1:
		r = s[::-1]
		if s[:k] == r[:k]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import *

def solve():
	(n, k) = map(int, input().split())
	s = input()
	if k * 2 + 1 > n:
		return 'NO'
	else:
		(a, b) = ('', '')
		for i in range(k):
			a += s[i]
		for i in range(n - 1, n - k - 1, -1):
			b += s[i]
		if a == b:
			return 'YES'
		else:
			return 'NO'
for _ in range(int(input())):
	print(solve())


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	lens = len(s)
	front = ''
	back = ''
	f = False
	if k == 0:
		f = True
	if lens % 2 == 0:
		lens -= 1
	for i in range(lens // 2):
		front += s[i]
		back = s[n - i - 1] + back
		rev = back[::-1]
		if k == 0:
			f = True
			break
		if front == rev and len(front) >= k:
			f = True
			break
	if f:
		print('YES')
	else:
		print('NO')


import math
from collections import defaultdict, Counter
from itertools import permutations
from decimal import Decimal, localcontext
from collections import defaultdict
ii = lambda : int(input())
li = lambda : list(map(int, input().split()))

def main():
	for _ in range(ii()):
		(n, k) = li()
		s = input()
		c = 0
		if k == 0:
			print('YES')
		else:
			a1 = s[:n // 2]
			a2 = s[n // 2 + 1:][::-1]
			c = 0
			for i in range(min(len(a1), len(a2))):
				if a1[i] == a2[i]:
					c += 1
				else:
					break
			if 2 * k + 1 <= n and c >= k:
				print('YES')
			else:
				print('NO')
import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd

def find(l):
	c = 0
	for i in range(len(l)):
		if l[i] > 1:
			c = i
			return c
	else:
		return None

def checkDivisibility(n, digit):
	return digit != 0 and n % digit == 0

def allDigitsDivide(n):
	nlist = list(map(int, set(str(n))))
	for digit in nlist:
		if digit != 0 and (not checkDivisibility(n, digit)):
			return False
	return True

def lcm(s):
	a = [int(d) for d in str(s)]
	lc = a[0]
	for i in a[1:]:
		if i != 0:
			lc = lc * i // gcd(lc, i)
	return lc
main()

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def random():
	rating = 100
	rating = rating * 100
	rating = rating * 100
	print(rating)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = [1]
	for p in range(2, n + 1):
		if prime[p]:
			l.append(p)
	return l

def fact(n):
	return 1 if n == 1 or n == 0 else n * fact(n - 1)

def prime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True


t = int(input())
while t > 0:
	t -= 1
	(n, m) = input().split()
	(n, k) = (int(n), int(m))
	s = input()
	if k == 0:
		print('Yes')
	else:
		ip = True
		for i in range(k):
			if not s[i] == s[n - i - 1]:
				ip = False
				break
		if not ip:
			print('No')
		elif n % 2 == 1:
			print('Yes')
		elif k == n / 2:
			print('No')
		else:
			print('Yes')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if s[:k] == s[::-1][:k] and n > 2 * k:
		print('YES')
	else:
		print('No')


def main():
	t = int(input())
	ANS = []
	for _ in range(t):
		(n, k) = map(int, input().split())
		s = input()
		if n < k * 2 + 1:
			ANS.append('NO')
		else:
			l = 0
			r = n - 1
			L = []
			R = []
			K = 0
			while l + 1 < r:
				L.append(s[l])
				R.append(s[r])
				if ''.join(L) == ''.join(R):
					K += 1
					L = []
					R = []
				l += 1
				r -= 1
			if K >= k:
				ANS.append('YES')
			else:
				ANS.append('NO')
	print('\n'.join(ANS))
main()


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split(' ')))
	s = input()
	l = 0
	remaining = n - 2 * (n // 2)
	if n // 2 == k and remaining == 0:
		print('NO')
		continue
	for index in range(n // 2):
		if s[index] == s[n - index - 1]:
			l += 1
		else:
			break
	if l < k:
		print('NO')
		continue
	print('YES')


for y in range(int(input())):
	(n, m) = map(int, input().split())
	s = input()
	i = 0
	cnt = 0
	j = n - 1
	foo = 0
	if m == 0:
		foo = 1
	while i < j:
		if s[i] == s[j]:
			cnt += 1
		else:
			break
		if cnt >= m and i != j - 1:
			foo = 1
		i += 1
		j -= 1
	if foo == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t = t - 1
	(n, k) = map(int, input().split())
	s = input()
	f = 0
	if k == 0:
		print('YES')
	elif n == 1:
		print('NO')
	elif n % 2 == 0 and k >= int(n / 2):
		print('NO')
	elif n % 2 == 1 and k > int(n / 2):
		print('NO')
	else:
		p1 = 0
		p2 = len(s) - 1
		while p1 < p2:
			if s[p1] == s[p2]:
				p1 = p1 + 1
				p2 = p2 - 1
				k = k - 1
				if k == 0:
					f = 1
					break
			else:
				break
		if f == 1:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	stk = input()
	left = 0
	ans = False
	while left < n:
		right = left
		while right < n:
			first = stk[:left]
			last = stk[right + 1:]
			if first == last[::-1] and left >= k:
				ans |= True
			right += 1
		left += 1
	if ans:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def solve():
	(n, k) = map(int, input().split())
	s = input().strip()
	(f, b, cnt) = (0, n - 1, 0)
	while f + 1 < b and s[f] == s[b]:
		cnt += 1
		f += 1
		b -= 1
	return 'YES' if cnt >= k else 'NO'
for _ in range(int(input())):
	print(solve())


def solve(s, n, k):
	if k == 0:
		print('YES')
	else:
		i = 0
		j = n - 1
		c = 0
		while i <= j:
			if s[i] == s[j]:
				c += 1
				i += 1
				j -= 1
			else:
				break
		if i >= j:
			if c >= k + 1:
				print('YES')
			else:
				print('NO')
		elif c >= k:
			print('YES')
		else:
			print('NO')
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	solve(s, n, k)


def solve(n, k, s):
	if k == 0:
		return 'YES'
	count = 0
	if n % 2:
		for i in range(n // 2):
			if s[i] == s[-i - 1]:
				count += 1
			else:
				break
		if count >= k:
			return 'YES'
		else:
			return 'NO'
	else:
		for i in range(n // 2 - 1):
			if s[i] == s[-i - 1]:
				count += 1
			else:
				break
		if count >= k:
			return 'YES'
		else:
			return 'NO'
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	print(solve(n, k, s))


import sys

def get_ints():
	return list(map(int, sys.stdin.readline().strip().split()))
testcases = int(input())
for testcase in range(testcases):
	arr = get_ints()
	n = arr[0]
	k = arr[1]
	strs = input()
	if n == 1:
		print('YES')
		continue
	if k == 0:
		print('YES')
		continue
	leftindex = 0
	rightindex = n - 1
	similar = 0
	oddflag = 0
	while leftindex <= rightindex:
		if leftindex == rightindex:
			oddflag = 1
			break
		if strs[leftindex] == strs[rightindex]:
			similar += 1
			leftindex += 1
			rightindex -= 1
			continue
		else:
			break
	if n & 1:
		if k > similar:
			print('NO')
		else:
			print('YES')
	elif k >= similar:
		print('NO')
	else:
		print('YES')


T = int(input())
for _ in range(T):
	(N, K) = [int(v) for v in input().split()]
	s = input()
	cur = 0
	for i in range(N - 1 >> 1):
		if s[i] == s[N - i - 1]:
			cur += 1
		else:
			break
	if cur >= K:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	(N, K) = map(int, input().split())
	st = input()
	count = N % 2
	for i in range(N // 2):
		if st[i] == st[-1 - i]:
			count += 1
		else:
			break
	if count == 0:
		count = 1
	if K < count:
		print('YES')
	else:
		print('NO')


import sys

def solve(s, n, k):
	if k == 0:
		return True
	for i in range(n // 2):
		if s[i] == s[n - i - 1]:
			k -= 1
		else:
			return False
		if k == 0:
			if n % 2 == 1:
				return True
			if i != n // 2 - 1:
				return True
	return False
t = int(input())
while t > 0:
	t -= 1
	(n, k) = list(map(int, input().strip().split()))
	s = input()
	if solve(s, n, k):
		print('YES')
	else:
		print('NO')


import sys
import os
import math
import copy
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations, accumulate

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def watch(x):
	return print(x)

def common(l1, l2):
	return set(l1).intersection(l2)

def Most_frequent(list):
	return max(set(list), key=list.count)

def check(s):
	n = len(s)
	if len(s) == 1:
		return True
	for i in range(n // 2):
		if s[i] != s[n - i - 1]:
			return False
	return True

def solution():
	for _ in range(Int()):
		(n, k) = Mint()
		s = Lstr()
		a = 0
		for i in range(k):
			if s[i] != s[n - i - 1]:
				a = 1
				break
		if a == 0 and k <= (n - 1) // 2:
			print('YES')
		else:
			print('NO')
solution()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	if k == 0:
		print('YES')
	elif n / k == n // k and n // k == 2:
		print('NO')
	else:
		i = 0
		j = n - 1
		count = 0
		while i < j:
			if s[i] == s[j]:
				count = count + 1
				if count + 1 == k + 1:
					print('YES')
					break
			if s[i] != s[j]:
				if count + 1 == k + 1:
					print('YES')
					break
				else:
					print('NO')
					break
			i = i + 1
			j = j - 1


from math import ceil
for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = input()
	l2 = l[::-1]
	theta = 0
	for i in range(n):
		if l[i] == l2[i]:
			theta += 1
		else:
			break
	if ceil(n / 2) == k:
		print('NO')
		continue
	if theta >= k:
		print('YES')
		continue
	print('NO')


import math
t = int(input())
cont = 0
for i in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	string = input()
	for j in range(math.ceil(len(string) / 2)):
		if string[j] == string[len(string) - j - 1]:
			cont += 1
		else:
			break
	if k == 0:
		print('YES')
	elif n % 2 == 0:
		if k <= cont and k < n / 2:
			print('YES')
		else:
			print('NO')
	elif k <= cont:
		print('YES')
	else:
		print('NO')
	cont = 0


for t in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	p = s
	p = p[::-1]
	e = 1
	if n - 2 * k <= 0:
		e = 0
	if s[:k] == p[:k] and e:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	x = tuple(map(int, input().split(' ')))
	s = input()
	af = []
	ar = []
	flag = 0
	if x[0] > 2 * x[1]:
		for j in range(x[1]):
			af.append(s[j])
			ar.append(s[x[0] - 1 - j])
		if af == ar:
			flag = 1
			print('YES')
	if flag == 0:
		print('NO')


from math import ceil, floor
yes = 'yes'
no = 'no'

def fun(st, ls):
	(n, k) = ls
	if k == 0:
		print(yes)
		return
	if ceil(n / 2) < k + 1:
		print(no)
		return
	count = 0
	for (i, val) in enumerate(st[:floor(n / 2)]):
		from_last = n - 1 - i
		val_last = st[from_last]
		if val == val_last:
			count += 1
		elif count < k:
			print(no)
			return
	print(yes)
T = int(input())
for i in range(T):
	ls = list(map(int, input().split()))
	st = input()
	fun(st, ls)


t = int(input())
for j in range(t):
	(n, k) = map(int, input().split())
	s = input()
	if k * 2 == n:
		print('NO')
	elif k == 0:
		print('YES')
	else:
		c = 0
		a = 'NO'
		for i in range(1, n // 2 + 1):
			f = s[:i]
			if f == s[::-1][:i]:
				if len(f) >= k:
					a = 'YES'
		print(a)


def check(s):
	return s == s[::-1]
t = int(input())
while t > 0:
	t = t - 1
	(n, k) = map(int, input().split())
	s = input()
	len = 2 * k + 1
	result = 'NO'
	if len > n:
		result = 'NO'
	elif k == 0 or check(s):
		result = 'YES'
	else:
		flag = True
		cnt = 0
		for i in range(0, n - 1):
			if cnt < k:
				if s[i] == s[n - 1 - i]:
					pass
				else:
					flag = False
			cnt += 1
		if flag:
			result = 'YES'
	print(result)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	r = 1
	for i in range(k):
		if s[i] != s[-1 - i]:
			r = 0
	if not r or k == n / 2:
		print('NO')
	else:
		print('YES')


tests = int(input())
for _ in range(tests):
	(n, k) = [int(x) for x in input().split()]
	s = input()
	result = True
	if k == 0:
		pass
	elif 2 * k >= n:
		result = False
	else:
		for i in range(0, k):
			if s[i] != s[-i - 1]:
				result = False
				break
	if result:
		print('YES')
	else:
		print('NO')


import math
testcases = int(input())
while testcases > 0:
	(n, k) = map(int, input().split())
	myString = input()
	if k == 0:
		print('YES')
	elif n == 2 * k:
		print('NO')
	else:
		flag = 0
		i = 0
		j = len(myString) - 1
		count = 1
		while count <= k and i != j:
			if myString[i] != myString[j]:
				flag = 1
				break
			count += 1
			i += 1
			j -= 1
		if flag == 1:
			print('NO')
		else:
			print('YES')
	testcases -= 1


t = int(input())
for i in range(t):
	ls = input().split()
	(n, k) = (int(ls[0]), int(ls[1]))
	s = input()
	a = len(s)
	if k == 0:
		print('YES')
	elif a != n:
		print('NO')
	elif n % 2 == 0 and k == n / 2:
		print('NO')
	else:
		ais = 0
		m = 0
		(t1, t2) = (0, n - 1)
		ls = list(s)
		while m < k and t1 < t2:
			if ls[t1] != ls[t2]:
				print('NO')
				ais = 1
				break
			t1 += 1
			t2 -= 1
			m += 1
		if ais == 0:
			print('YES')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	s = input()
	start = 0
	end = n - 1
	for i in range((n + 1) // 2):
		if s[end] == s[i]:
			start += 1
			end -= 1
		else:
			break
	if n < m * 2 + 1:
		print('NO')
	elif start >= m:
		print('YES')
	else:
		print('NO')


def imali(s, n, k):
	i = 0
	l = 0
	while i < n // 2 and s[i] == s[n - i - 1]:
		l += 1
		i += 1
	if l >= k and k * 2 < n:
		print('YES')
	else:
		print('NO')
prim = int(input())
while prim > 0:
	lista = input().split(' ')
	n = int(lista[0])
	k = int(lista[1])
	s = input()
	imali(s, n, k)
	prim -= 1


def strip(N, k, s):
	t = ''
	q = ''
	i = 0
	j = N - 1
	while i < j:
		if s[i] == s[j]:
			t += s[i]
		else:
			break
		i += 1
		j -= 1
	if i <= j:
		q += s[i:j + 1]
	if q == '':
		if len(t) < k + 1:
			print('NO')
		else:
			print('YES')
	elif len(t) < k:
		print('NO')
	else:
		print('YES')
for _ in range(int(input())):
	(N, k) = map(int, input().split())
	s = input()
	strip(N, k, s)


t = int(input())
for z in range(t):
	(n, k) = [int(q) for q in input().split()]
	s = input()
	a = s[:k] + s[n - k:]
	if k == n / 2:
		print('NO')
	elif k == 0 or a == a[::-1]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = input()
	count = 0
	if n % 2 == 0:
		for i in range(0, n // 2 - 1):
			if a[i] == a[n - i - 1]:
				count += 1
			else:
				break
	else:
		for i in range(0, n // 2):
			if a[i] == a[n - i - 1]:
				count += 1
			else:
				break
	if count >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	(n, k) = list(map(int, input().split()))
	a = input()
	if n >= 2 * k + 1:
		if k == 0:
			print('YES')
		else:
			x = 0
			for i in range(k):
				if a[i] != a[-i - 1]:
					x = 1
					break
			if x == 0:
				print('YES')
			else:
				print('NO')
	else:
		print('NO')


T = int(input())
for t in range(T):
	(N, K) = [int(k) for k in input().split()]
	S = input()
	if K == 0:
		print('YES')
		continue
	front = 0
	end = N - 1
	cnt = 0
	while front < end - 1 and S[front] == S[end]:
		cnt += 1
		front += 1
		end -= 1
	if K > cnt:
		print('NO')
	else:
		print('YES')


m = int(input())
for j in range(0, m):
	(a, b) = map(int, input().split())
	p = input()
	l = p[a - b:a]
	if a >= 2 * b + 1:
		if p[0:b] == l[::-1]:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def f(x, n, k):
	if n <= 2 * k:
		return False
	for i in range(k):
		if x[i] != x[n - 1 - i]:
			return False
	return True
tc = int(input())
for _ in range(tc):
	(n, k) = map(int, input().split())
	x = input().rstrip()
	print('YES' if f(x, n, k) else 'NO')


import sys
import os.path
if os.path.exists('input_file.txt'):
	sys.stdin = open('input_file.txt', 'r')
	sys.stdout = open('output_file.txt', 'w')
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = input()
	f = 1
	if k == 0:
		print('YES')
		f = 0
	elif n < k * 2 + 1:
		print('NO')
		f = 0
	else:
		f = 1
		l = 0
		r = n - 1
		while k > l:
			if a[r] != a[l]:
				print('NO')
				f = 0
				break
			l += 1
			r -= 1
		if f:
			print('YES')


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	(n, k) = map(int, input().split())
	S = input().strip()
	if k == 0:
		print('YES')
		continue
	if k * 2 + 1 > n:
		print('NO')
		continue
	flag = 1
	for i in range(k):
		if S[i] == S[n - 1 - i]:
			True
		else:
			flag = 0
			break
	if flag == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
n = []
k = []
string = []
for i in range(t):
	m = []
	m = input().split()
	m = [int(i) for i in m]
	string.append(input())
	n.append(m[0])
	k.append(m[1])
for i in range(t):
	str1 = string[i]
	n1 = n[i]
	k1 = k[i]
	c_1 = str1[0:k1]
	c_2 = str1[-1:-(k1 + 1):-1]
	if k1 == 0:
		print('YES')
	elif 2 * k1 + 1 > n[i]:
		print('NO')
	elif c_1 == c_2:
		print('YES')
	else:
		print('NO')


import sys

def find_palin(s, length):
	p1 = 0
	p2 = length - 1
	while p2 >= p1 and s[p1] == s[p2]:
		p1 += 1
		p2 -= 1
	return p1
n = int(sys.stdin.readline().strip())
ans = 0
for i in range(n):
	line = sys.stdin.readline().strip()
	values = list(map(int, line.split()))
	(length, k) = values
	word = sys.stdin.readline().strip()
	if length <= k * 2:
		print('NO')
		continue
	if k == 0:
		print('YES')
		continue
	palin_len = find_palin(word, length)
	if palin_len < k:
		print('NO')
	else:
		print('YES')


def check(s, n, k):
	if k == 0:
		return True
	if 2 * k + 1 > n:
		return False
	c = 0
	for i in range(n // 2):
		if s[i] != s[n - i - 1]:
			break
		c += 1
	if k <= c:
		return True
	return False
for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	s = input()
	if check(s, n, k):
		print('YES')
	else:
		print('NO')


A = int(input())
num = []
for i in range(A):
	n = input()
	a = int(n.split(' ')[1])
	n = int(n.split(' ')[0])
	b = input()
	sum = 0
	d = 0
	for j in range(n // 2 if n % 2 != 0 else n // 2 - 1):
		if b[d:j + 1] == b[-1 - d:n - j - 2:-1]:
			sum += 1
			d = j + 1
	if sum >= a:
		num.append('YES')
	else:
		num.append('NO')
for i in num:
	print(i)


from collections import Counter, deque
from itertools import accumulate, product, groupby
import operator
import math
from functools import reduce

def solve():
	(n, k) = [int(char) for char in input().split()]
	s = input()
	if k == 0:
		return True
	i = k - 1
	j = n - 1 - i
	if i + 1 >= j:
		return False
	(front, back) = (s[:k], s[::-1][:k])
	return front == back
for _ in range(int(input())):
	print('YES') if solve() else print('NO')


from math import *
from random import *
for t in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	f = True
	for i in range(k):
		if s[i] != s[n - 1 - i]:
			f = False
	if n % 2 == 0 and n // 2 == k:
		f = False
	if f:
		print('YES')
	else:
		print('NO')


import sys
t = int(input())
for _t in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	s = input()
	if not k:
		print('YES')
		continue
	i = 0
	while i < n // 2 and s[i] == s[-i - 1]:
		i += 1
	if i * 2 == n:
		i -= 1
	print('YES' if i >= k else 'NO')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	print('YES' if k * 2 < n and s[:k] == s[-1:-1 - k:-1] else 'NO')


for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	s = list(input())
	i = 0
	x = 0
	if k == 0:
		print('YES')
	elif k == n // 2 and n % 2 == 0:
		print('NO')
	else:
		for i in range(n // 2):
			if s[i] == s[n - 1 - i]:
				x += 1
			else:
				break
		if x >= k:
			print('YES')
		else:
			print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	start = 0
	end = n - 1
	K = 0
	while s[start] == s[end]:
		if start + 1 >= end:
			break
		start += 1
		end -= 1
		K += 1
	print('YES' if K >= k else 'NO')


T_ON = 1
DEBUG_ON = 1
MOD = 998244353

def solve():
	(n, k) = read_ints()
	s = input()
	i = 0
	j = n - 1
	while i <= j:
		if i >= k:
			YES()
			return
		if s[i] != s[j]:
			break
		i += 1
		j -= 1
	NO()

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def fib_to_n(n):
	f = []
	(a, b) = (0, 1)
	while a <= n:
		f.append(a)
		(a, b) = (b, a + b)
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		debug(n, i)
		if n % i == 0:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P

def is_lucky(n):
	return set(list(str(n))).issubset({'4', '7'})
main()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	i = 0
	j = n - 1
	count = 0
	if n % 2 == 0:
		l = 1
	else:
		l = 0
	while j - i > l:
		if s[i] == s[j]:
			count += 1
		else:
			break
		i += 1
		j -= 1
	if count >= k:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, k) = map(int, input().split())
	s = list(input())
	if k >= n / 2:
		print('NO')
		continue
	count = 0
	for i in range(k):
		if s[i] == s[-1 - i]:
			count += 1
		else:
			break
	if count >= k:
		print('YES')
	else:
		print('NO')


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest
from copy import deepcopy
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))

def inps():
	return sys.stdin.readline()

def inpsl(x):
	tmp = sys.stdin.readline()
	return list(tmp[:x])

def err(x):
	print(x)
	exit()
for _ in range(inp()):
	(n, k) = inpl()
	s = inpsl(n)
	if n == k * 2:
		print('NO')
		continue
	for i in range(k):
		if s[i] == s[-1 - i]:
			pass
		else:
			print('NO')
			break
	else:
		print('YES')


def Solve():
	(n, k) = map(int, input().split())
	s = input()
	if k == 0:
		print('YES')
	elif k * 2 >= n:
		print('NO')
	else:
		a = list(s[:k])
		b = list(s[n - k:n])
		b.reverse()
		if a == b:
			print('YES')
		else:
			print('NO')
q = int(input())
while q:
	Solve()
	q -= 1


t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	s = input()
	if k == 0:
		print('YES')
		continue
	if n % 2 == 0 and k == n // 2:
		print('NO')
		continue
	f = 0
	for i in range(k):
		if s[i] == s[n - 1 - i]:
			continue
		else:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	if k == 0:
		print('YES')
	else:
		there_is_sequence = False
		palin_length = 0
		for i in range(0, len(s) // 2):
			if s[i] == s[len(s) - i - 1]:
				palin_length += 1
			else:
				break
		if palin_length < k or len(s) - 2 * k == 0:
			print('NO')
		else:
			print('YES')


from sys import stdin, stdout
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if k == 0:
		print('YES')
	elif n == 2 * k:
		print('NO')
	else:
		g = ''
		h = ''
		for i in range(0, k + 1):
			g += s[i]
		for j in range(n - k, n):
			h += s[j]
		g += h
		b = g[::-1]
		if b == g:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	j = 0
	t = 'YES'
	if k == n / 2:
		print('NO')
		continue
	for i in range(k):
		if s[j] != s[n - 1 - j]:
			t = 'NO'
			break
		j += 1
	print(t)


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	s = input()
	l = 0
	r = n - 1
	i = 0
	flag = True
	while l < r and i < k:
		if s[l] != s[r]:
			print('NO')
			flag = False
			break
		r -= 1
		l += 1
		i += 1
	if not flag:
		continue
	if i < k or l > r:
		print('NO')
	else:
		print('YES')


from math import ceil
t = int(input().strip())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	ans = []
	if k == 0:
		print('YES')
	else:
		for i in range(k):
			if s[i] != s[n - i - 1]:
				print('NO')
				break
		else:
			if n % 2 == 0 and k == n // 2:
				print('NO')
			else:
				print('YES')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	f = True
	cnt = 0
	for i in range(n // 2):
		if s[i] == s[n - i - 1] and cnt + 1 <= k:
			cnt += 1
		else:
			f = False
			break
	if cnt >= k and cnt * 2 != n:
		print('YES')
	else:
		print('NO')


cases = int(input())
resultados = []
for c in range(cases):
	data = input().split()
	lenOfString = int(data[0])
	k = int(data[1])
	strinToEval = input()
	splitIt = True
	if k == 0:
		resultados.append('YES')
	elif 2 * k + 1 <= lenOfString:
		half = int(lenOfString / 2)
		if lenOfString % 2 == 0:
			--half
		for h in range(half):
			if strinToEval[h] != strinToEval[lenOfString - h - 1]:
				if h < k:
					resultados.append('NO')
					splitIt = False
				break
		if splitIt:
			resultados.append('YES')
	else:
		resultados.append('NO')
for r in resultados:
	print(r)


def solve():
	(n, k) = map(int, input().split())
	s = input()
	if k == 0:
		print('YES')
		return
	ans = 0
	(l, r) = (0, n - 1)
	while l < r:
		if s[l] == s[r]:
			ans += 1
		else:
			break
		l += 1
		r -= 1
	ans = min(ans, k)
	if ans >= k and ans * 2 < n:
		print('YES')
	else:
		print('NO')
T = int(input())
for _ in range(T):
	solve()


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	string = input()
	if k == 0:
		print('YES')
	else:
		ok = True
		for i in range(k):
			ok = ok and string[i] == string[n - i - 1]
		if ok == True and 2 * k < n:
			print('YES')
		else:
			print('NO')


N = int(input())
for t in range(N):
	(n, k) = list(map(int, input().split()))
	string = input()
	j = 0
	count = 0
	startString = ''
	endString = ''
	while j < n // 2:
		startString += string[j]
		endString += string[n - 1 - j]
		if startString == endString:
			count += 1
			startString = ''
			endString = ''
		j += 1
	if n % 2 == 1:
		count += 1
	if count >= k + 1 or k == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	s = input()
	check = True
	for i in range(k + 1):
		if s[i] != s[-i - 1] and i != k:
			check = False
			break
	print('YES' if (check or k == 0) and n != 2 * k else 'NO')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = input()
	q = 'YES'
	for a in range(k):
		if s[a] != s[n - 1 - a]:
			q = 'NO'
	if n < k * 2 + 1:
		q = 'NO'
	print(q)


for nt in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if 2 * k == n:
		print('NO')
		continue
	ans = 'NO'
	if s[0:k] == s[n - k:][::-1]:
		ans = 'YES'
	print(ans)


import math

def getint():
	return [int(i) for i in input().split()]

def getstr():
	return [str(i) for i in input().split()]

def solve():
	(n, k) = getint()
	string = input()
	if k == 0:
		print('YES')
		return
	if 2 * k + 1 > n:
		print('NO')
		return
	i = 0
	j = n - 1
	ans = 0
	while ans != k and j - 1 > 1:
		if string[i] == string[j]:
			ans += 1
			i += 1
			j -= 1
		else:
			print('NO')
			break
	else:
		print('YES')
for _ in range(int(input())):
	solve()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	string = input()
	ans = True
	p1 = string[0:k]
	p2 = string[k + 1::-1]
	for i in range(0, k):
		if string[i] != string[n - i - 1]:
			ans = False
	if ans and k * 2 < n:
		print('YES')
	else:
		print('NO')


def f(n, k, s):
	if k == 0:
		return True
	if 2 * k >= n:
		return False
	return s[:k] == s[-k:][::-1]
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	if f(n, k, s):
		print('YES')
	else:
		print('NO')


from sys import stdin
from sys import stdout
from math import *
import sys
for __ in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	pos = 0
	for i in range(n // 2):
		if s[i] == s[-(i + 1)]:
			pos += 1
		else:
			break
	if pos >= k and n >= k + k + 1:
		print('YES')
	elif k == 0:
		print('YES')
	else:
		print('NO')


def solve(s, k):
	n = len(s)
	if n <= 2 * k:
		return 'NO'
	return 'YES' if s[:k] == s[:n - k - 1:-1] else 'NO'
for _ in range(int(input())):
	(_, k) = map(int, input().split())
	s = input()
	print(solve(s, k))


for testcase in range(int(input())):
	(n, k) = map(int, input().split())
	s = input()
	res = ''
	(i, j) = (0, n - 1)
	while i < j:
		if s[i] != s[j]:
			break
		i += 1
		j -= 1
	if i >= k and k < (n + 1) // 2:
		print('YES')
	else:
		print('NO')


q = int(input())
while q:
	(n, k) = map(int, input().split())
	s = input()
	cnt = 0
	for i in range(0, n // 2):
		if s[i] == s[n - i - 1]:
			cnt += 1
		else:
			break
	if cnt >= k and n > k * 2:
		print('YES')
	else:
		print('NO')
	q -= 1


def good(s, k):
	n = len(s)
	if 2 * k == n:
		return False
	i = 0
	while i < k and s[i] == s[n - 1 - i]:
		i += 1
	return i == k
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	print('YES' if good(s, k) else 'NO')


for tc in range(int(input())):
	(n, k) = map(int, input().split())
	s = input().strip()
	for i in range(k):
		if s[i] != s[n - 1 - i]:
			print('NO')
			break
	else:
		if 2 * k != n:
			print('YES')
		else:
			print('NO')


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial, sqrt
from collections import defaultdict, Counter, OrderedDict, deque
from itertools import combinations, accumulate
from bisect import *
from functools import reduce
from operator import mul
star = lambda x: print(' '.join(map(str, x)))
grid = lambda r: [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
INF = float('inf')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
import sys
from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def inlt():
	return list(map(int, stdin.readline().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, stdin.readline().split())

def pr(n):
	return stdout.write(str(n) + '\n')

def solve():
	(n, k) = invr()
	s = input()
	l = 0
	r = len(s) - 1
	while r > l and k > 0:
		if s[l] == s[r]:
			l += 1
			r -= 1
			k -= 1
		else:
			break
	if r >= l:
		k = k - 1
	if k < 0:
		print('YES')
	else:
		print('NO')
t = 1
t = inp()
for _ in range(t):
	solve()


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from time import time
from itertools import permutations as per
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	(n, k) = R()
	s = S()
	if k == 0:
		print('YES')
		continue
	if n >= k * 2 + 1 and s[n - k:] == s[:k][::-1]:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	string = input()
	count = 0
	i = 0
	j = len(string) - 1
	while i <= j and string[i] == string[j]:
		count += 1
		i += 1
		j -= 1
	if i < j:
		count += 1
	if count >= k + 1:
		print('YES')
	else:
		print('NO')


def palindrome(s, k):
	if s[:k] == s[::-1][:k]:
		return True
	return False
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s = input()
	if b == 0:
		print('YES')
	elif a % 2 == 0:
		if b == a // 2:
			print('NO')
		elif palindrome(s, b):
			print('YES')
		else:
			print('NO')
	elif palindrome(s, b):
		print('YES')
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp = lambda : list(map(int, sys.stdin.readline().rstrip('\r\n').split()))
mod = 10 ** 9 + 7
Mod = 998244353
INF = float('inf')
tc = 1
tc = int(input())
for _ in range(tc):
	(n, k) = inp()
	s = str(input())
	f = True
	i = 0
	j = n - 1
	while k > 0:
		if i + 1 >= j:
			f = False
			break
		if s[i] == s[j]:
			pass
		else:
			f = False
			break
		i += 1
		j -= 1
		k -= 1
	print('YES' if f else 'NO')


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
MOD = 10 ** 9 + 7

def solve():
	(n, k) = map(int, input().split())
	A = input().rstrip()
	cnt = 0
	itr = n // 2
	if n % 2 == 0:
		itr -= 1
	for i in range(itr):
		if A[i] == A[-(i + 1)]:
			cnt += 1
		else:
			break
	print('YES' if cnt >= k else 'NO')
t = int(input())
for _ in range(t):
	solve()


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	s = input().strip()
	if k >= (n + 1) // 2:
		print('NO')
		continue
	(l, r) = (0, n - 1)
	while l <= r:
		if s[l] == s[r]:
			k -= 1
			l += 1
			r -= 1
		else:
			break
	if k > 0 or (k == 0 and l == r):
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def process(n, k, s):
	if k == 0:
		return True
	if n == 2:
		return False
	counter = 0
	yes = False
	if n % 2 == 0:
		end = n // 2 - 1
	else:
		end = n // 2
	for i in range(end):
		if s[i] == s[n - i - 1]:
			counter += 1
		else:
			break
	if counter >= k:
		yes = True
	return yes

def main():
	t = inp()
	for case in range(t):
		(n, k) = inlt()
		s = insr()
		yes = process(n, k, s)
		if yes:
			print('YES')
		else:
			print('NO')
main()


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	s = input()
	if 2 * k + 1 <= n:
		x = s[:k]
		y = s[:n - k - 1:-1]
		if x == y:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from math import floor
for _ in range(int(input())):
	(x, k) = [int(i) for i in input().split()]
	a = input()
	e = 0
	if k == 0:
		print('YES')
	else:
		for i in range(floor(x / 2)):
			if a[i] == a[-i - 1]:
				e = e + 1
			elif e < k:
				print('NO')
				break
			else:
				print('YES')
				break
		else:
			if x % 2 == 0:
				if e > k:
					print('YES')
					continue
				print('NO')
			else:
				if e < k:
					print('NO')
				print('YES')


t = int(input())
for T in range(t):
	(n, k) = list(map(int, input().split()))
	s = input()
	c = 0
	if n % 2 != 0:
		for i in range(n // 2):
			if s[i] == s[n - i - 1]:
				c += 1
			else:
				break
	else:
		for i in range(n // 2 - 1):
			if s[i] == s[n - i - 1]:
				c += 1
			else:
				break
	if c >= k:
		print('YES')
	else:
		print('NO')