#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll k,a,b,j,l,m,o;
  ll n,t,i;
  cin>>t;
  while(t--){
    cin>>n>>k;
    string s;
    cin>>s;
    if(k==0){
        cout<<"YES"<<endl;continue;
    }
    ll r=n-1;
    l=0;
    b=0;
    while(l<r)
    {
        if(s[l]==s[r])
        {
           b++;l++;r--;    
        }
        else
        {
            break;
        }
    }
    if(l<=r){b++;}
    if(b>=k+1)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
   
  }
  return 0;
  
}