#include <iostream>
#include <cstring>
using namespace std;

class node{
 public:
  long long int x;
  long long int y;
  long long int d1;
  long long int d2;
  bool exist;
  node(){
      exist = false;
  }
  node(int _x,int _y){
      x = _x,y = _y;
      exist = true;
  }
};

void initialize(int term);
void show(int term);
void distance(int m);
void sort(int term);
void jiaohuan(int n, int lun);
void showSort(int term);
void doSign(int lun,int term);
bool exmaine(int term);

node p1,p2;
node f[2000];
long long int s1[2][2000];
long long int s2[2][2000];
bool sign[2000];
long long int answer[2000+2];

int main(){
    int term(0);
    cin >> term;
    initialize(term);
    //show(term);

    //show(term);
    sort(term);
    //showSort(term);
    memset(answer,9223372036854775807 , sizeof(answer));
    for(int i(0);i < term;i++){
        memset(sign,0, sizeof(sign));
        doSign(i,term);
        for(int j(term-1);j > 0;j--){
            sign[s2[0][j]] = 1;
            if(exmaine(term) == true){
                answer[i] = s1[1][i] + s2[1][j];
                break;
            }
        }
        //memset(sign,0, sizeof(sign));
    }

    answer[term] = s1[1][0];
    answer[term+1] = s2[1][0];
    long long int min(9223372036854775807);
    for(int i(0);i < term+2;i++){
        if(answer[i] < min && answer[i] >= 0) min = answer[i];
    }
/*
    showSort(term);

    for(int i(0);i < term+2;i++){
        cout << answer[i] << " ";
    }
    cout << endl;
*/
    cout << min;
}

void initialize(int term){
    int term1,term2,term3,term4;
    cin >> term1 >> term2 >> term3 >> term4;
    p1 = node(term1,term2);
    p2 = node(term3,term4);
    for(int i(0);i < term;i++){
        cin >> term1 >> term2;
        f[i] = node(term1,term2);
        distance(i);
        s1[0][i] = i, s2[0][i] = i;
        s1[1][i] = f[i].d1, s2[1][i] = f[i].d2;
    }
}

void show(int term){
    cout << p1.x << " " << p1.y << " " << p2.x << " " << p2.y << endl;
    for(int i(0);i < term;i++){
        cout << f[i].x << " " << f[i].y << " " << f[i].d1 << " " << f[i].d2 << endl;
    }
}

void distance(int m){
    f[m].d1 = (p1.x - f[m].x)*(p1.x - f[m].x) + (p1.y - f[m].y)*(p1.y - f[m].y);
    f[m].d2 = (p2.x - f[m].x)*(p2.x - f[m].x) + (p2.y - f[m].y)*(p2.y - f[m].y);
}

void sort(int term){
    for(int i(1);i < term;i++){
        for(int j(i); j >= 1; j--){
            if(s1[1][j-1] < s1[1][j]){
                jiaohuan(1,j);
            }
            if(s2[1][j-1] < s2[1][j]){
                jiaohuan(2,j);
            }
        }
    }
}

void jiaohuan(int n, int lun){
    if(n != 1 && n != 2){
        cout << "出错";
        return;
    }

    if(n == 1){
        long long int term0,term1;
        term0 = s1[0][lun-1];
        term1 = s1[1][lun-1];
        s1[0][lun-1] = s1[0][lun];
        s1[1][lun-1] = s1[1][lun];
        s1[0][lun]   = term0;
        s1[1][lun]   = term1;
    }

    if(n == 2){
        long long int term0,term1;
        term0 = s2[0][lun-1];
        term1 = s2[1][lun-1];
        s2[0][lun-1] = s2[0][lun];
        s2[1][lun-1] = s2[1][lun];
        s2[0][lun]   = term0;
        s2[1][lun]   = term1;
    }
}

void showSort(int term){
    for(int i(0);i < term;i++){
        cout << s1[0][i] << " " << s1[1][i] <<" " << s2[0][i] << " " << s2[1][i] << endl;
    }
}

void doSign(int lun,int term){
    for(int i(lun);i < term;i++){
        sign[s1[0][i]] = 1;
    }
}

bool exmaine(int term){
    for(int i(0);i < term;i++){
        if(sign[i] != 1){
            return false;
        }
    }

    return true;
}


#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <vector>
struct cor{
	int x,y;
};
class hi{
public:
	long long a,b;
	bool operator <(const hi&i)const{return (a<i.a)||((a==i.a)&&(b<i.b));}
};
using std::vector;
int main(){
	cor f1,f2;
	vector <cor>flower;
	vector <hi>dis;
	cor tempc;
	hi temph;
	int i,j,n;
	long long r1,r2;
	long long ans=0,temp=0;
	scanf("%d%d%d%d%d",&n,&f1.x,&f1.y,&f2.x,&f2.y);
	for(i=0;i<n;++i){
		scanf("%d%d",&tempc.x,&tempc.y);
		flower.push_back(tempc);
		temph.a=pow(flower[i].x-f1.x,2)+pow(flower[i].y-f1.y,2);
		temph.b=pow(flower[i].x-f2.x,2)+pow(flower[i].y-f2.y,2);
		if(temph.a&&temph.b){
			dis.push_back(temph);
		}else{
			--i;
			--n;
		}
	}
	std::sort(dis.begin(),dis.end());
	ans=dis[i].a;
	r2=0;
	for(i=n-1;i>=0;--i){
		r1=dis[i].a;
		temp=r1+r2;
		if(temp<ans){
			ans=temp;
		}
//		printf("T%d\t%d\t%d\n",r1,r2,temp);
		if(dis[i].b>r2){
			r2=dis[i].b;
		}
	}
	printf("%d",ans);
	return 0;
}


#include<iostream>
using namespace std;

struct node
{
	int r1;
	int r2;
};
int n;
int x1,y1,x2,y2;
int r2_max;
int minium;
node points[2001];
int main(void)
{
	cin>>n;
	cin>>x1>>y1>>x2>>y2;
	for(int i=1;i<=n;i++)
	{
		int x,y;
		cin>>x>>y;
		points[i].r1=(x1-x)*(x1-x)+(y1-y)*(y1-y);
		points[i].r2=(x2-x)*(x2-x)+(y2-y)*(y2-y);
		if (i==1)
			continue;
		else
			for(int j=i;j>=2;j--)
			{
				if(points[j].r1>points[j-1].r1)
				{
					node tmp;
					tmp=points[j];
					points[j]=points[j-1];
					points[j-1]=tmp;
				}
			}
	}
	r2_max=points[1].r2;
	minium=points[1].r1;
	for(int i=2;i<=n;i++)
	{
		r2_max=max(r2_max,points[i-1].r2);
		minium=min(minium,points[i].r1+r2_max);
	}
	r2_max=max(r2_max,points[n].r2);
	minium=min(minium,r2_max);
	cout<<minium;

}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

struct flower {
	int x, y ;
	long long int dis1 ;
	long long int dis2 ;
};

bool compare(const flower &a, const flower & b) {
	return b.dis1<a.dis1;
}

int main()
{

		int n;
		int x1, y1;
		int x2, y2;
		vector<flower> fs;
		cin >> n >> x1 >> y1 >> x2 >> y2;
		for (int i = 0; i < n; ++i) {
			flower temp;
			cin >> temp.x >> temp.y;
			temp.dis1 = (temp.x - x1)*(temp.x - x1) + (temp.y - y1)*(temp.y - y1);
			temp.dis2 = (temp.x - x2)*(temp.x - x2) + (temp.y - y2)*(temp.y - y2);
			fs.push_back(temp);
		}
		sort(fs.begin(), fs.end(), compare);
		long long int R1 = 0, R2 = 0;
		long long int S = 0;
		for (int i = 0; i < n; ++i) {
			if (fs[i].dis2 >= R2) {
				R2 = fs[i].dis2;
			}
		}
		S = R2;
		for (int i = 0; i < n; ++i) {
			R1 = fs[i].dis1;
			R2 = 0;
			for (int j = 0; j < i; ++j) {
				if (fs[j].dis2 >= R2) {
					R2 = fs[j].dis2;
				}
			}
			if (R1 + R2 <= S) {
				S = R1 + R2;
			}
		}

		cout << S;

    return 0;
}


#include<stdio.h>
#include<iostream>
#include<set>
using namespace std;
const int maxn=2077;

double dis(double x1,double y1,double x2,double y2){
        return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
}

int N,X1,Y1,X2,Y2;

struct NODE{
        int x,y;
        double d;
        bool operator <(const NODE &o)const{
                return d<o.d;
        }
};
set<NODE> S1,S2;

double ans=1.0/0.0;

int main(){
        scanf("%d%d%d%d%d",&N,&X1,&Y1,&X2,&Y2);
        for(int i=0;i<N;++i){
                int x,y;scanf("%d%d",&x,&y);
                S1.insert((NODE){x,y,dis(x,y,X1,Y1)});
        }

        ans=S1.rbegin()->d;
        set<NODE>::reverse_iterator it=S1.rbegin();
        S2.insert((NODE{it->x,it->y,dis(it->x,it->y,X2,Y2)}));
        S1.erase(*it);

        while(!S1.empty()){
                ans=min(ans, S1.rbegin()->d + S2.rbegin()->d);
                set<NODE>::reverse_iterator it=S1.rbegin();
                S2.insert((NODE{it->x,it->y,dis(it->x,it->y,X2,Y2)}));
                S1.erase(*it);
        }

        ans=min(ans, S2.rbegin()->d);

        printf("%lld\n",(long long)(ans+0.1));
}


#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<math.h>
#include<cstring>
#include<algorithm>
using namespace std;
struct node
{
	long long from1,from2;
}flower[2005];
bool cmp(node a,node b)
{
	return a.from1>b.from1;
}
int main()
{
	int n;
	long long ans=999999999999999999,maxx,x1,y1,x2,y2;
	long long x,y;
	scanf("%d%lld%lld%lld%lld",&n,&x1,&y1,&x2,&y2);
	for(int i=1;i<=n;i++)
	  {
	  	scanf("%lld%lld",&x,&y);
	  	flower[i].from1=(x-x1)*(x-x1)+(y-y1)*(y-y1);
	  	flower[i].from2=(x-x2)*(x-x2)+(y-y2)*(y-y2);
	  }
	sort(flower+1,flower+1+n,cmp);
	for(int i=1;i<=n;i++)
	  {
	  	maxx=0;
	  	for(int j=1;j<i;j++)
	  	  maxx=max(maxx,flower[j].from2);
	  	ans=min(ans,maxx+flower[i].from1);
	  }
	printf("%lld\n",ans);
	return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	long long int n, p, q;
	long long int disA[2000];

	long long int x_A, y_A, x_B, y_B;
	long long int x[2000], y[2000];
	long long int temp0;
	long long int temp3, temp2;
	long long int result = 0;
	cin >> n >> x_A >> y_A >> x_B >> y_B;
	for (int i = 0; i < n; i++)
	{
		cin >> p >> q;
		x[i] = p; y[i] = q;
	}
	for (int i = 0; i < n; i++)
	{
		disA[i] = pow((x[i] - x_A), 2) + pow((y[i] - y_A), 2);

	}
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			if (disA[i] > disA[j])
			{
				temp0 = disA[i];
				temp2 = x[i];
				temp3 = y[i];
				disA[i] = disA[j];
				x[i] = x[j];
				y[i] = y[j];
				disA[j] = temp0;
				x[j] = temp2;
				y[j] = temp3;
			}
		}
	}
	if (n >= 2) {
		int minsum = pow(x[n -1] - x_A, 2) + pow(y[n - 1] - y_A, 2);
		for (int i = n - 1; i >= 0; i--)
		{
			int count = 0;
			int maxB = pow(x[n - 1] - x_B, 2) + pow(y[n - 1] - y_B, 2);

			for (int j = i; j < n; j++)
			{

				if (pow(x[j] - x_B, 2) + pow(y[j] - y_B, 2) >maxB)
				{
					maxB = pow(x[j] - x_B, 2) + pow(y[j] - y_B, 2);
					count = j;

				}

			}
			if (minsum >(maxB + pow(x[i - 1] - x_A, 2) + pow(y[i - 1] - y_A, 2))&&i!=0)
			{
				minsum = maxB + pow(x[i - 1] - x_A, 2) + pow(y[i - 1] - y_A, 2);
			}
			else if (i == 0) {
				if (minsum > maxB)minsum = maxB;
			}
			result = minsum;

		}

	}
	else if (n = 1)
	{
		int count = 0;
		int minsum = pow(x[count] - x_B, 2) + pow(y[count] - y_B, 2);
		if (minsum > pow(x[count] - x_A, 2) + pow(y[count] - y_A, 2))
			minsum = pow(x[count] - x_A, 2) + pow(y[count] - y_A, 2);
		result = minsum;

	}

	cout << result << endl;
	return 0;
}


#include <iostream>
using namespace std;

long long cor[2000][2]={0};
long long res[2000]={0};
void sort(int num,int index);

int main(){
    int num=0;
    int x,y,x1,y1,x2,y2=0;
    long long r1_2=0;
    long long r2_2=0;
    long long ans=0;
    cin>>num>>x1>>y1>>x2>>y2;
    for (int i = 0; i < num; ++i) {
        cin>>x>>y;
        cor[i][0]=(x-x1)*(x-x1)+(y-y1)*(y-y1);
        cor[i][1]=(x-x2)*(x-x2)+(y-y2)*(y-y2);
    }

    sort(num,0);
    for (int j = 0; j < num; ++j) {
        r2_2=0;
        r1_2=cor[j][0];
        for (int i = j+1; i < num; ++i) {
            if(cor[i][1]>r2_2)r2_2=cor[i][1];
        }
        res[j]=r1_2+r2_2;
    }
    ans=res[0];
    for (int k = 0; k < num; ++k) {
        if(ans>res[k])ans=res[k];
    }

    sort(num,1);
    for (int l = 0; l < num; ++l) {
        r1_2=0;
        r2_2=cor[l][1];
        for (int i = l+1; i < num; ++i) {
            if(cor[i][0]>r1_2)r1_2=cor[i][0];
        }
        res[l]=r1_2+r2_2;
    }
    for (int m = 0; m < num; ++m) {
        if(ans>res[m])ans=res[m];
    }
    cout<<ans<<endl;
    return 0;
}

void sort(int num,int index){
    long long temp1,temp2=0;
    for (int i = 0; i < num; ++i) {
        for (int j = 0; j < num - 1; ++j) {
            if(cor[j][index]>cor[j+1][index]){
                temp1=cor[j][index];
                cor[j][index]=cor[j+1][index];
                cor[j+1][index]=temp1;

                temp2=cor[j][1-index];
                cor[j][1-index]=cor[j+1][1-index];
                cor[j+1][1-index]=temp2;
            }
        }
    }
}


#include<iostream>

using namespace std;

struct cor
{
	int x;
	int y;
};
struct dis
{
	int d1;
	int d2;
};
int distanceOfAB(cor A, cor B);
void sort();
cor foutain1, foutain2,currentFlower;
int n,r1=0,r2=0;
dis dist[2000];
int currentMax = 0;
int main()
{
	cin >> n >> foutain1.x >> foutain1.y >> foutain2.x >> foutain2.y;
	for (int i = 0; i < n; ++i)
	{
		cin >> currentFlower.x >> currentFlower.y;
		dist[i].d1 = distanceOfAB(foutain1, currentFlower);
		dist[i].d2 = distanceOfAB(foutain2, currentFlower);
	}
	sort();
	for (int i = 0; i < n; ++i)
	{
		r1 = dist[i].d1;
		for (int j = 0; j < i; ++j)
		{
			if(dist[j].d2>r2&&i!=j)
			{
				r2 = dist[j].d2;
			}
		}
		if (i == 0)
		{
			currentMax = r1 + r2;
		}
		if (r1 + r2 < currentMax)
		{
			currentMax = r1 + r2;
		}
	}
	cout << currentMax;
}

int distanceOfAB(cor A, cor B)
{
	int dis;
	dis = (A.x - B.x)*(A.x - B.x) + (A.y - B.y)*(A.y - B.y);
	return dis;
}

void sort()
{
	dis temp;
	for (int i = 1; i <n ; ++i)
	{
		for (int j = i; j > 0; --j)
		{
			if (dist[j].d1 > dist[j - 1].d1)
			{
				temp = dist[j];
				dist[j] = dist[j - 1];
				dist[j - 1] = temp;
			}
		}
	}
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
#define sqr(x) ((LL)(x)*(x))
int n, x1, x2, Y1, y2;
struct point{
    int x, y;
    LL d1, d2;
    void calc(){
        d1 = sqr(x - x1) + sqr(y - Y1);
        d2 = sqr(x - x2) + sqr(y - y2);
    }
    int operator < (const point &t)const{
        return d1 < t.d1;
    }
} ps[2003];
int main(){
    cin >> n >> x1 >> Y1 >> x2 >> y2;
    for (int i = 1; i <= n;i++){
        cin >> ps[i].x >> ps[i].y;
        ps[i].calc();
    }
    sort(ps + 1, ps + n + 1);
    ps[0].d1 = 0;
    LL ans = ps[n].d1,mx=0;
    for (int i=n; i >=1; i--){
        mx = max(mx, ps[i].d2);
        ans = min(ans, mx + ps[i - 1].d1);
    }
    cout << ans << endl;
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;

const int maxn=2005;
struct point
{
	int x,y;
	point(int x=0,int y=0):x(x),y(y){}
};
point k1,k2,data[maxn];
long long dis(point a,point b)
{
	int x=a.x-b.x,y=a.y-b.y;
	return (long long)x*x+(long long)y*y;
}
bool cmp1(point a,point b)
{
	int x1=a.x-k1.x,y1=a.y-k1.y,x2=b.x-k1.x,y2=b.y-k1.y;
	return (long long)x1*x1+(long long)y1*y1<(long long)x2*x2+(long long)y2*y2;
}
int n;
void readin()
{
	scanf("%d",&n);
	scanf("%d%d%d%d",&k1.x,&k1.y,&k2.x,&k2.y);
	for(int i=0;i<n;i++)
		scanf("%d%d",&data[i].x,&data[i].y);
	sort(data,data+n,cmp1);
}
long long ans=0;
void solve()
{
	point M=k2;
	ans=1000000000000000LL;
	for(int i=n-1;i>=0;i--)
	{
		long long k=dis(M,k2)+dis(data[i],k1);
		if(k<ans)
			ans=k;
		if(dis(M,k2)<dis(data[i],k2))
			M=data[i];
	}
	ans=min(dis(M,k2),ans);
	printf("%lld\n",ans);
}
int main()
{
	readin();
	solve();
	return 0;
}


#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <vector>
struct cor{
	int x,y;
};
class hi{
public:
	long long a,b;
	bool operator <(const hi&i)const{return (a<i.a)||((a==i.a)&&(b<i.b));}
};
using std::vector;
int main(){
	cor f1,f2;
	vector <cor>flower;
	vector <hi>dis;
	cor tempc;
	hi temph;
	int i,j,n;
	unsigned long long r1=0,r2=0;
	unsigned long long ans=0,temp=0;
	scanf("%d%d%d%d%d",&n,&f1.x,&f1.y,&f2.x,&f2.y);
	for(i=0;i<n;++i){
		scanf("%d%d",&tempc.x,&tempc.y);
		flower.push_back(tempc);
		temph.a=pow(flower[i].x-f1.x,2)+pow(flower[i].y-f1.y,2);
		temph.b=pow(flower[i].x-f2.x,2)+pow(flower[i].y-f2.y,2);
		if(temph.a&&temph.b){
			dis.push_back(temph);
		}else{
			--i;
			--n;
		}
	}
	std::sort(dis.begin(),dis.end());
	ans=dis[n-1].a;
//	printf("%d",ans);
	r2=0;
	for(i=n-1;i>=0;--i){
		r1=dis[i].a;
		temp=r1+r2;
		if(temp<ans){
			ans=temp;
		}
//		printf("T%d\t%d\t%d\n",r1,r2,temp);
		if(dis[i].b>r2){
			r2=dis[i].b;
		}
	}
	if(r2<ans){
		ans=r2;
	}
	printf("%d",ans);
}


#include <cstdio>
#include <queue>
int n;
long long ans = (1LL << 63) - 1, div, max;
std::pair<int, int> x, y, a[2005];
long long dis(std::pair<int, int> A, std::pair<int, int> B) {
	return (long long)(A.first- B.first) * (A.first - B.first) + (long long)(A.second - B.second) * (A.second - B.second);
}
int main() {
	scanf("%d%d%d%d%d", &n, &x.first, &x.second, &y.first, &y.second);
	for(int i = 1; i <= n; ++i)
		scanf("%d%d", &a[i].first, &a[i].second);
	for(int i = 1; i <= n; ++i) {
		max = 0;
		div = dis(x, a[i]);
		for(int j = 1; j <= n; ++j)
			if(dis(x, a[j]) > div)
				max = std::max(max, dis(y, a[j]));
		ans = std::min(ans, div + max);
	}
	printf("%I64d\n", ans);
}


#include <iostream>
#include <cstring>
using namespace std;

class node{
 public:
  long long int x;
  long long int y;
  long long int d1;
  long long int d2;
  bool exist;
  node(){
      exist = false;
  }
  node(int _x,int _y){
      x = _x,y = _y;
      exist = true;
  }
};

void initialize(int term);
void show(int term);
void distance(int m);
void sort(int term);
void jiaohuan(int n, int lun);
void showSort(int term);
void doSign(int lun,int term);
bool exmaine(int term);

node p1,p2;
node f[2000];
long long int s1[2][2000];
long long int s2[2][2000];
bool sign[2000];
long long int answer[2000+2];

int main(){
    int term(0);
    cin >> term;
    initialize(term);
    //show(term);

    //show(term);
    sort(term);
    //showSort(term);
    memset(answer,2147483647 , sizeof(answer));
    for(int i(0);i < term;i++){
        memset(sign,0, sizeof(sign));
        doSign(i,term);
        for(int j(term-1);j > 0;j--){
            sign[s2[0][j]] = 1;
            if(exmaine(term) == true){
                answer[i] = s1[1][i] + s2[1][j];
                break;
            }
        }
        memset(sign,-1, sizeof(sign));
    }

    answer[term] = s1[1][0];
    answer[term+1] = s2[1][0];
    long long int min(2147483647);
    for(int i(0);i < term+2;i++){
        if(answer[i] < min) min = answer[i];
    }
///*
    showSort(term);

    for(int i(0);i < term+2;i++){
        cout << answer[i] << " ";
    }
    cout << endl;
//*/
    cout << min;
}

void initialize(int term){
    int term1,term2,term3,term4;
    cin >> term1 >> term2 >> term3 >> term4;
    p1 = node(term1,term2);
    p2 = node(term3,term4);
    for(int i(0);i < term;i++){
        cin >> term1 >> term2;
        f[i] = node(term1,term2);
        distance(i);
        s1[0][i] = i, s2[0][i] = i;
        s1[1][i] = f[i].d1, s2[1][i] = f[i].d2;
    }
}

void show(int term){
    cout << p1.x << " " << p1.y << " " << p2.x << " " << p2.y << endl;
    for(int i(0);i < term;i++){
        cout << f[i].x << " " << f[i].y << " " << f[i].d1 << " " << f[i].d2 << endl;
    }
}

void distance(int m){
    f[m].d1 = (p1.x - f[m].x)*(p1.x - f[m].x) + (p1.y - f[m].y)*(p1.y - f[m].y);
    f[m].d2 = (p2.x - f[m].x)*(p2.x - f[m].x) + (p2.y - f[m].y)*(p2.y - f[m].y);
}

void sort(int term){
    for(int i(1);i < term;i++){
        for(int j(i); j >= 1; j--){
            if(s1[1][j-1] < s1[1][j]){
                jiaohuan(1,j);
            }
            if(s2[1][j-1] < s2[1][j]){
                jiaohuan(2,j);
            }
        }
    }
}

void jiaohuan(int n, int lun){
    if(n != 1 && n != 2){
        cout << "出错";
        return;
    }

    if(n == 1){
        long long int term0,term1;
        term0 = s1[0][lun-1];
        term1 = s1[1][lun-1];
        s1[0][lun-1] = s1[0][lun];
        s1[1][lun-1] = s1[1][lun];
        s1[0][lun]   = term0;
        s1[1][lun]   = term1;
    }

    if(n == 2){
        long long int term0,term1;
        term0 = s2[0][lun-1];
        term1 = s2[1][lun-1];
        s2[0][lun-1] = s2[0][lun];
        s2[1][lun-1] = s2[1][lun];
        s2[0][lun]   = term0;
        s2[1][lun]   = term1;
    }
}

void showSort(int term){
    for(int i(0);i < term;i++){
        cout << s1[0][i] << " " << s1[1][i] <<" " << s2[0][i] << " " << s2[1][i] << endl;
    }
}

void doSign(int lun,int term){
    for(int i(lun);i < term;i++){
        sign[s1[0][i]] = 1;
    }
}

bool exmaine(int term){
    for(int i(0);i < term;i++){
        if(sign[i] != 1){
            return false;
        }
    }

    return true;
}


#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	long long int n, p, q;
	long long int disA[2000];

	long long int x_A, y_A, x_B, y_B;
	long long int x[2000], y[2000];
	long long int temp0;
	long long int temp3, temp2;
	long long int result = 0;
	cin >> n >> x_A >> y_A >> x_B >> y_B;
	for (int i = 0; i < n; i++)
	{
		cin >> p >> q;
		x[i] = p; y[i] = q;
	}
	for (int i = 0; i < n; i++)
	{
		disA[i] = pow((x[i] - x_A), 2) + pow((y[i] - y_A), 2);

	}
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			if (disA[i] > disA[j])
			{
				temp0 = disA[i];
				temp2 = x[i];
				temp3 = y[i];
				disA[i] = disA[j];
				x[i] = x[j];
				y[i] = y[j];
				disA[j] = temp0;
				x[j] = temp2;
				y[j] = temp3;
			}
		}
	}

	if (n >= 2) {
		long long int minsum = pow(x[n -1] - x_A, 2) + pow(y[n - 1] - y_A, 2);
		for (int i = n - 1; i >= 0; i--)
		{
			int count = 0;
			long long int maxB = pow(x[n - 1] - x_B, 2) + pow(y[n - 1] - y_B, 2);

			for (int j = i; j < n; j++)
			{

				if (pow(x[j] - x_B, 2) + pow(y[j] - y_B, 2) >maxB)
				{
					maxB = pow(x[j] - x_B, 2) + pow(y[j] - y_B, 2);
					count = j;

				}

			}

			if (minsum >(maxB + pow(x[i - 1] - x_A, 2) + pow(y[i - 1] - y_A, 2))&&i!=0)
			{
				minsum = maxB + pow(x[i - 1] - x_A, 2) + pow(y[i - 1] - y_A, 2);
			}
			else if (i == 0) {
				if (minsum > maxB)minsum = maxB;
			}
			result = minsum;

		}

	}
	else if (n = 1)
	{
		int count = 0;
		long long int minsum = pow(x[count] - x_B, 2) + pow(y[count] - y_B, 2);
		if (minsum > pow(x[count] - x_A, 2) + pow(y[count] - y_A, 2))
			minsum = pow(x[count] - x_A, 2) + pow(y[count] - y_A, 2);
		result = minsum;

	}

	cout << result << endl;
	return 0;
}


#include<iostream>
using namespace std;
bool covered(int bestr1,int bestr2,int dist[][2],int n);
int main()
{
	int n,x1,y1,x2,y2;
	cin>>n>>x1>>y1>>x2>>y2;
	int coord[2000][2];
	for(int i=0;i<n;i++)
	{
		cin>>coord[i][0]>>coord[i][1];
	}

	int dist[2000][2];
	for (int i=0;i<n;i++)
	{
		dist[i][0]=(coord[i][0]-x1)*(coord[i][0]-x1)+(coord[i][1]-y1)*(coord[i][1]-y1);
	}
	for (int i=0;i<n;i++)
	{
		dist[i][1]=(coord[i][0]-x2)*(coord[i][0]-x2)+(coord[i][1]-y2)*(coord[i][1]-y2);
	}
	int best=dist[0][0]+dist[0][1];
	int bestr1=dist[0][0];
	int bestr2=dist[0][1];
	for(int i=0;i<n;i++)
	{
		for (int j=0;j<n;j++)
		{
			if(covered(dist[i][0],dist[j][1],dist,n) && (dist[i][0]+dist[j][1] < best))
			{
				best=dist[i][0]+dist[j][1];
				bestr1=dist[i][0];
				bestr2=dist[j][1];
			}
		}
	}
	cout<<best;
	return 0;
}
bool covered(int bestr1,int bestr2,int dist[][2],int n)
{
	for(int k=0;k<n;k++)
	{
		if (bestr1<dist[k][0] && bestr2<dist[k][1])
		{
			return false;
		}
	}
	return true;
}


#include<iostream>
int qian(long long int t1[], long long int t2[], int n, int i);
long long int dis(long long int x1, long long int y1, long long int x2, long long int y2);
using namespace std;
int main()
{
	long long int n, x1, y1, x2, y2;
	cin >> n >> x1 >> y1 >> x2 >> y2;
	int i, j, k;
	long long int w, z, t, length;
	long long int t1max = 0, t2max = 0;
	long long int min = 40000000000000000;
	long long int t1[2003] = { 0 };
	long long int t2[2003] = { 0 };
	for (i = 0; i < n; i++)
	{
		cin >> w >> z;
		t1[i] = dis(x1, y1, w, z);
		t2[i] = dis(x2, y2, w, z);
		if (t1max < t1[i])
			t1max = t1[i];
		if (t2max < t2[i])
			t2max = t2[i];
	}
	t1[i] = 0, t2[i] = t2max;
	i++, n++;
	t1[i] = t1max, t2[i] = 0;
	i++, n++;
	for (i = 0; i < n; i++)
	for (j = 1; j < n; j++)
	{
		if (t1[j - 1]>t1[j])
		{
			t = t2[j];
			t2[j] = t2[j - 1];
			t2[j - 1] = t;
			t = t1[j];
			t1[j] = t1[j - 1];
			t1[j - 1] = t;
		}
	}
	length = n;
	for (j = 0; j < length; j++)
	{
		for (i = 0; i < length - 1; i++)
		{
			if (t2[i] < t2[i + 1])
			{
				length = qian(t1, t2, length, i);
				i--;
			}
		}
	}
	for (i = 0; i < length - 1; i++)
	{
		t = t1[i] + t2[i + 1];
		if (min>t)
			min = t;
	}
	cout << min;
}
int qian(long long int t1[], long long int t2[], int n, int i)
{
	for (; i < n; i++)
	{
		t1[i] = t1[i + 1];
		t2[i] = t2[i + 1];
	}
	return n - 1;
}
long long int dis(long long int x1, long long int y1, long long int x2, long long int y2)
{
	return (x2 - x1)*(x2 - x1) + (y1 - y2)*(y1 - y2);
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int INF = 1e17;
typedef long long ll;
ll n, fx1, fx2, fy1, fy2;
ll Xcord[2018], Ycord[2018];
struct
{
	ll d1;
	ll d2;
}Dis[2018];
int main()
{
	scanf("%I64d %I64d %I64d %I64d %I64d", &n, &fx1, &fy1, &fx2, &fy2);
	for (int i = 1; i <= n; ++i)
	{
		scanf("%I64d %I64d", &Xcord[i], &Ycord[i]);
		Dis[i].d1 = (Xcord[i] - fx1)*(Xcord[i] - fx1) + (Ycord[i] - fy1)*(Ycord[i] - fy1);
		Dis[i].d2 = (Xcord[i] - fx2)*(Xcord[i] - fx2) + (Ycord[i] - fy2)*(Ycord[i] - fy2);
	}

	ll ans = INF;
	for (int i = 1; i <= n + 1; ++i)
	{
		ll r2 = 0;
		for (int j = 1; j <= n; ++j)
			if (Dis[j].d1 > Dis[i].d1)
				r2 = max(r2, Dis[j].d2);
		ans = min(ans, Dis[i].d1 + r2);
	}
	printf("%I64d", ans);
	return 0;
}


#include<iostream>
using namespace std;

long long X1;
long long Y1;
long long X2;
long long Y2;
long long Max1=0;
long long Max2=0;
long long TransDistance1(long long x,long long y)
{
	return (x-X1)*(x-X1)+(y-Y1)*(y-Y1);
}

int TransDistance2(long long x,long long y)
{
	return (x-X2)*(x-X2)+(y-Y2)*(y-Y2);
}

int number;

int Min;
int tempMax;
int main()
{
	long long  tempx,tempy;
	cin>>number>>X1>>Y1>>X2>>Y2;
	long long* First = new long long [number];
	long long* Second = new long long [number];
	for(int i=0;i<number;i++)
	{
		cin>>tempx>>tempy;
		First[i] = TransDistance1(tempx,tempy);
		Second[i] = TransDistance2(tempx,tempy);
	}
	for(int i=0;i<number;i++)
	{
		long long t = First[i];//第一个水池的最远覆盖。
		tempMax = 0;
		for(int j=0;j<number;j++)
		{
			if(First[j]>t&&Second[j]>tempMax)
			{
				tempMax = Second[j];
			}
		}
		if(i==0||t+tempMax<Min)
		{
		 Min=t+tempMax;
		}
	}
	int a;
	for(int i=0;i<number;i++)
	{
		if(Second[i]>a)
		a = Second[i];
	}
	if(a<Min)
	{
		Min=a;
	}
	cout<<Min;
}


#include <iostream>
#include <cstring>
using namespace std;

class node{
 public:
  int x;
  int y;
  long long int d1;
  long long int d2;
  bool exist;
  node(){
      exist = false;
  }
  node(int _x,int _y){
      x = _x,y = _y;
      exist = true;
  }
};

void initialize(int term);
void show(int term);
void distance(int m);
void sort(int term);
void jiaohuan(int n, int lun);
void showSort(int term);
void doSign(int lun,int term);
bool exmaine(int term);

node p1,p2;
node f[2000];
long long int s1[2][2000];
long long int s2[2][2000];
bool sign[2000];
long long int answer[2000+2];

int main(){
    int term(0);
    cin >> term;
    initialize(term);
    //show(term);

    //show(term);
    sort(term);
    //showSort(term);
    memset(answer,2147483647 , sizeof(answer));
    for(int i(0);i < term;i++){
        memset(sign,0, sizeof(sign));
        doSign(i,term);
        for(int j(term-1);j > 0;j--){
            sign[s2[0][j]] = 1;
            if(exmaine(term) == true){
                answer[i] = s1[1][i] + s2[1][j];
                break;
            }
        }
        memset(sign,-1, sizeof(sign));
    }

    answer[term] = s1[1][0];
    answer[term+1] = s2[1][0];
    long long int min(2147483647);
    for(int i(0);i < term+2;i++){
        if(answer[i] < min) min = answer[i];
    }

    showSort(term);

    for(int i(0);i < term;i++){
        cout << answer[i] << " ";
    }
    cout << endl;

    cout << min;
}

void initialize(int term){
    int term1,term2,term3,term4;
    cin >> term1 >> term2 >> term3 >> term4;
    p1 = node(term1,term2);
    p2 = node(term3,term4);
    for(int i(0);i < term;i++){
        cin >> term1 >> term2;
        f[i] = node(term1,term2);
        distance(i);
        s1[0][i] = i, s2[0][i] = i;
        s1[1][i] = f[i].d1, s2[1][i] = f[i].d2;
    }
}

void show(int term){
    cout << p1.x << " " << p1.y << " " << p2.x << " " << p2.y << endl;
    for(int i(0);i < term;i++){
        cout << f[i].x << " " << f[i].y << " " << f[i].d1 << " " << f[i].d2 << endl;
    }
}

void distance(int m){
    f[m].d1 = (p1.x - f[m].x)*(p1.x - f[m].x) + (p1.y - f[m].y)*(p1.y - f[m].y);
    f[m].d2 = (p2.x - f[m].x)*(p2.x - f[m].x) + (p2.y - f[m].y)*(p2.y - f[m].y);
}

void sort(int term){
    for(int i(1);i < term;i++){
        for(int j(i); j >= 1; j--){
            if(s1[1][j-1] < s1[1][j]){
                jiaohuan(1,j);
            }
            if(s2[1][j-1] < s2[1][j]){
                jiaohuan(2,j);
            }
        }
    }
}

void jiaohuan(int n, int lun){
    if(n != 1 && n != 2){
        cout << "出错";
        return;
    }

    if(n == 1){
        long long int term0,term1;
        term0 = s1[0][lun-1];
        term1 = s1[1][lun-1];
        s1[0][lun-1] = s1[0][lun];
        s1[1][lun-1] = s1[1][lun];
        s1[0][lun]   = term0;
        s1[1][lun]   = term1;
    }

    if(n == 2){
        long long int term0,term1;
        term0 = s2[0][lun-1];
        term1 = s2[1][lun-1];
        s2[0][lun-1] = s2[0][lun];
        s2[1][lun-1] = s2[1][lun];
        s2[0][lun]   = term0;
        s2[1][lun]   = term1;
    }
}

void showSort(int term){
    for(int i(0);i < term;i++){
        cout << s1[0][i] << " " << s1[1][i] <<" " << s2[0][i] << " " << s2[1][i] << endl;
    }
}

void doSign(int lun,int term){
    for(int i(lun);i < term;i++){
        sign[s1[0][i]] = 1;
    }
}

bool exmaine(int term){
    for(int i(0);i < term;i++){
        if(sign[i] != 1){
            return false;
        }
    }

    return true;
}


#include<iostream>
using namespace std;

struct node
{
	int r1;
	int r2;
};
int n;
int x1,y1,x2,y2;
int r2_max;
int minium;
node points[2001];
int main(void)
{
	cin>>n;
	cin>>x1>>y1>>x2>>y2;
	for(int i=1;i<=n;i++)
	{
		int x,y;
		cin>>x>>y;
		points[i].r1=(x1-x)*(x1-x)+(y1-y)*(y1-y);
		points[i].r2=(x2-x)*(x2-x)+(y2-y)*(y2-y);
		if (i==1)
			continue;
		else
			for(int j=i;j>=2;j--)
			{
				if(points[j].r1>points[j-1].r1)
				{
					node tmp;
					tmp=points[j];
					points[j]=points[j-1];
					points[j-1]=tmp;
				}
			}
	}
	r2_max=points[1].r2;
	minium=points[1].r1;
	for(int i=2;i<=n;i++)
	{
		r2_max=max(r2_max,points[i-1].r2);
		minium=min(minium,points[i].r1+r2_max);
	}
	r2_max=max(r2_max,points[n].r2);
	minium=min(minium,r2_max);
	cout<<minium;

}


#include<iostream>
using namespace std;

long long X1;
long long Y1;
long long X2;
long long Y2;
long long Max1=0;
long long Max2=0;
long long TransDistance1(long long x,long long y)
{
	return (x-X1)*(x-X1)+(y-Y1)*(y-Y1);
}

int TransDistance2(long long x,long long y)
{
	return (x-X2)*(x-X2)+(y-Y2)*(y-Y2);
}

int number;

long long Min;
long long tempMax;
int main()
{
	long long  tempx,tempy;
	cin>>number>>X1>>Y1>>X2>>Y2;
	long long* First = new long long [number];
	long long* Second = new long long [number];
	for(int i=0;i<number;i++)
	{
		cin>>tempx>>tempy;
		First[i] = TransDistance1(tempx,tempy);
		Second[i] = TransDistance2(tempx,tempy);
	}
	for(int i=0;i<number;i++)
	{
		long long t = First[i];//第一个水池的最远覆盖。
		tempMax = 0;
		for(int j=0;j<number;j++)
		{
			if(First[j]>t&&Second[j]>tempMax)
			{
				tempMax = Second[j];
			}
		}
		if(i==0||t+tempMax<Min)
		{
		 Min=t+tempMax;
		}
	}
	long long a;
	for(int i=0;i<number;i++)
	{
		if(Second[i]>a)
		a = Second[i];
	}
	if(a<Min)
	{
		Min=a;
	}
	cout<<Min;
}


#include <iostream>
#include <cmath>

int main() {
    long int n, x1, y1, x2, y2, x, y, d1, d2;
    long int r1 = 0, r2 = 0;
    std::cin >> n >> x1 >> y1 >> x2 >> y2;
    for (int i = 0; i < n; ++i) {
        std::cin >> x >> y;
        d1 = pow(std::abs(x - x1), 2) + pow(std::abs(y - y1), 2);
        d2 = pow(std::abs(x - x2), 2) + pow(std::abs(y - y2), 2);
        if (d1 > r1 && d2 > r2){
            if ((d1 + r2) > (d2 + r1)) r2 = d2;
            else if ((d1 + r2) <= (d2 + r1)) r1 = d1;
        }
    }
    std::cout << r1 + r2;
    return 0;
}


#include<bits/stdc++.h>
#define inf 1000000000000000000ll
#define N 2005
#define sqr(x) 1ll*(x)*(x)
using namespace std;
struct node {
	long long x,y;
}a[N];
long long A[N],ans;
int i,j,k,l,s,n,m,x,y,X,Y,x2,y2;
inline long long getdis(int x,int y,int X,int Y) {
	return sqr(x-X)+sqr(y-Y);
}
inline bool cmp(node x,node y) {
	return x.x<y.x;
}
int main() {
	scanf("%d%d%d%d%d",&n,&X,&Y,&x2,&y2);
	for (i=1;i<=n;i++) {
		scanf("%d%d",&x,&y);
		a[i].x=getdis(x,y,X,Y);
		a[i].y=getdis(x,y,x2,y2);
	}
	sort(a+1,a+1+n,cmp);
	for (i=n;i;i--) A[i]=max(A[i+1],a[i].y);
	ans=A[1];
	for (i=1;i<=n;i++) ans=min(ans,a[i].x+A[i+1]);
	printf("%lld\n",ans);
}


#include<stdio.h>

#define NUMFLOWER 2000

typedef struct {
	int x;
	int y;
} point;

typedef struct {
	point coor;
	long long d1;
	long long d2;
} flowers;

void ReadInAndPre(int *NumP, point* fount1, point* fount2, flowers* flower);
void MergeSort(flowers* flower, flowers* tmp, int (*Dis1)(flowers, flowers), int s, int e);
void GetMin(long long *MinDis, flowers* flower, int NumP);
void Merge(flowers* flower, flowers* tmp, int(*Dis1)(flowers, flowers), int s, int e);
int Dis1(flowers, flowers);

int main()
{
	flowers flower[NUMFLOWER + 5], tmp[NUMFLOWER + 5];
	int NumP = 0;
   	long long MinDis;
	point fount1, fount2;

	ReadInAndPre(&NumP, &fount1, &fount2, flower);
	if (NumP == 1) {
		if (flower[0].d1 < flower[0].d2) {
			printf("%lld\n", flower[0].d1);
		}
		else {
			printf("%lld\n", flower[0].d2);
		}
		return 0;
	}
	MergeSort(flower, tmp, Dis1, 0, NumP - 1);
	GetMin(&MinDis, flower, NumP);
	printf("%lld\n", MinDis);

	return 0;
}

void ReadInAndPre(int *NumP, point* fount1, point* fount2, flowers* flower) {
	scanf("%d", NumP);
	scanf("%d %d %d %d", &fount1->x, &fount1->y, &fount2->x, &fount2->y);
	for (int i = 0; i < *NumP; i++) {
		scanf("%d %d", &flower[i].coor.x, &flower[i].coor.y);
		flower[i].d1 = (flower[i].coor.x - fount1->x) * (flower[i].coor.x - fount1->x) + (flower[i].coor.y - fount1->y) * (flower[i].coor.y - fount1->y);
		flower[i].d2 = (flower[i].coor.x - fount2->x) * (flower[i].coor.x - fount2->x) + (flower[i].coor.y - fount2->y) * (flower[i].coor.y - fount2->y);
	}
	//puts("ReadInAndPre Done!");
}

void MergeSort(flowers* flower, flowers* tmp, int (*Dis)(flowers, flowers), int s, int e) {
	if (s >= e) {
		return;
	}
	int mid = (s + e) / 2;
	MergeSort(flower, tmp, Dis, s, mid);
	MergeSort(flower, tmp, Dis, mid + 1, e);
	Merge(flower, tmp, Dis, s, e);
}

void GetMin(long long *MinDis, flowers* flower, int NumP)
{
	*MinDis = flower[NumP - 1].d1;
	/*for (int i = NumP - 2; i >= 0; i--) {
		if (flower[i].d2 < flower[i + 1].d2) {
			flower[i].d2 = flower[i + 1].d2;
		}
	}*/
	/*if (flower[0].d2 < *MinDis) {
		*MinDis = flower[0].d2;
	}*/
	int d2Max = 0;
	for (int i = 0; i < NumP; i++) {
		if (d2Max < flower[i].d2) {
			d2Max = flower[i].d2;
		}
	}
	if (d2Max < *MinDis) {
		*MinDis = d2Max;
	}
	for (int i = 0; i < NumP - 1; i++) {
		/*if (*MinDis > flower[i].d1 + flower[i + 1].d2) {
			*MinDis = flower[i].d1 + flower[i + 1].d2;
		}*/
		int j = i + 1, Max = 0;
		while (flower[j].d1 == flower[i].d1) {
			j++;
		}
		while (j < NumP) {
			if (Max < flower[j].d2) {
				Max = flower[j].d2;
			}
			j++;
		}
		if (*MinDis > flower[i].d1 + Max) {
			*MinDis = flower[i].d1 + Max;
		}
	}
}

void Merge(flowers* flower, flowers* tmp, int(*Dis1)(flowers, flowers), int s, int e)
{
	int mid = (s + e) / 2;
	int i = s, j = mid + 1, index = s;

	//puts("Merge Begin!");
	while (i <= mid && j <= e) {
		//printf("%d %d \n", i , j);
		while (j <= e && i <= mid && Dis1(flower[i], flower[j])) {
			tmp[index] = flower[i];
			index++;
			i++;
		}
		while (j <= e && i <= mid && Dis1(flower[j], flower[i])) {
			tmp[index] = flower[j];
			index++;
			j++;
		}
	}
	//	printf("%d %d \n", i , j);
	while (i <= mid) {
		tmp[index] = flower[i];
		index++;
		i++;
	}
	while (j <= e) {
		tmp[index] = flower[j];
		index++;
		j++;
	}
	for (int i = s; i <= e; i++) {
		flower[i] = tmp[i];
	}
	//	printf("%d %d \n", i , j);
}

int Dis1(flowers a, flowers b) {
	if (a.d1 < b.d1) {
		return 1;
	}
	else if (a.d1 == b.d1 && a.d2 >= b.d2) {
		return 1;
	}
	return 0;
}


#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
*/

using namespace std;

/*--------------------------Containers------------------------*/
typedef     long long int           ll;
typedef     unsigned long long int  ull;
typedef     vector < int >          vi;
typedef     vector < ll >           vll;
typedef     vector < vi >           vvi;
typedef     pair< int,int >         pi;
typedef     pair< ll, ll >          pll;
typedef     vector< pi >            vpi;
typedef     vector< pll >           vpll;
/*------------------------------------------------------------*/

/*--------------------------Limits & Constants----------------*/
#define     MAX                 200007
#define     MOD                 int(1e9+7)
#define     INF                 ll(8230219982008199610)
#define     MINF                ll(-8230219982008199610)
#define     IL                  INT_MAX
#define     MIL                 INT_MIN
#define     PI                  2*acos(0.0)
/*------------------------------------------------------------*/

/*--------------------------Macros----------------------------*/
#define     fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define     pf                  printf
#define     sc                  scanf
#define     all(a)              (a).begin(),(a).end()
#define     sz(x)               int(x.size())
#define     pb                  push_back
#define     eb                  emplace_back
#define     mp                  make_pair
#define     ff                  first
#define     ss                  second
#define     mem(a,n)            memset(a, n, sizeof(a) )
#define     gcd(a,b)            __gcd(a,b)
#define     lcm(a,b)            (a*(b/gcd(a,b)))
#define     forn(i,n)          for(int i=0; i<n; i++)
#define     loop1(i,n)          for(int i=1; i<=n; i++)
#define     rev0(i,n)           for(int i=n-1; i>=0; i--)
#define     rev1(i,n)           for(int i=n; i>0; i--)
/*------------------------------------------------------------*/

/*----------------------Scans and Prints----------------------*/
#define     sc1(x)              scanf("%d",&x)
#define     sc2(x,y)            scanf("%d %d",&x,&y)
#define     sc3(x,y,z)          scanf("%d %d %d",&x,&y,&z)
#define     scd1(x)             scanf("%lld",&x)
#define     scd2(x,y)           scanf("%lld %lld",&x,&y)
#define     pf1(x)              printf("%d\n",x)
#define     pf2(x,y)            printf("%d %d\n",x,y)
#define     pfd1(x)             printf("%lld\n",x)
#define     pfd2(x,y)           printf("%lld %lld\n",x,y)
#define     t_case(t)           for(int cs = 1; cs<=t; cs++)
#define     print(a,n)          for(int pr = 0; pr<int(n); pr++)cout<<a[pr]<<" ";cout<<endl
#define     printa(x)           cout<<x<<endl;
#define     debug               cout<<" OK "<<endl
/*------------------------------------------------------------*/

int main()
{
	//FASTIO
	ll t;
	cin>>t;
	while(t--)
	{
	ll n;
	cin>>n;
	ll x;
	cin>>x;
	vll a(n);
	ll yes=0;
	vll odd;
	vll even;
	forn(i,n)
	{
	cin>>a[i];
	if(a[i]%2==1)
		odd.pb(a[i]);
	else
		even.pb(a[i]);
	}
	if(odd.size()==0)
	{
		cout<<"No"<<endl;
		continue;
	}
	ll k=1;
	ll ko=0;
	x=x-1;

	while(x>0)
	{
		if(even.size()!=ko+1)
		{
			++ko;
			--x;
			continue;
		}
		else if(odd.size()-1>=k+2)
		{
			k+=2;
			x-=2;
		}
		else
			break;
	}
	if(x==0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}
}


#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
*/

using namespace std;

/*--------------------------Containers------------------------*/
typedef     long long int           ll;
typedef     unsigned long long int  ull;
typedef     vector < int >          vi;
typedef     vector < ll >           vll;
typedef     vector < vi >           vvi;
typedef     pair< int,int >         pi;
typedef     pair< ll, ll >          pll;
typedef     vector< pi >            vpi;
typedef     vector< pll >           vpll;
/*------------------------------------------------------------*/

/*--------------------------Limits & Constants----------------*/
#define     MAX                 200007
#define     MOD                 int(1e9+7)
#define     INF                 ll(8230219982008199610)
#define     MINF                ll(-8230219982008199610)
#define     IL                  INT_MAX
#define     MIL                 INT_MIN
#define     PI                  2*acos(0.0)
/*------------------------------------------------------------*/

/*--------------------------Macros----------------------------*/
#define     fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define     pf                  printf
#define     sc                  scanf
#define     all(a)              (a).begin(),(a).end()
#define     sz(x)               int(x.size())
#define     pb                  push_back
#define     eb                  emplace_back
#define     mp                  make_pair
#define     ff                  first
#define     ss                  second
#define     mem(a,n)            memset(a, n, sizeof(a) )
#define     gcd(a,b)            __gcd(a,b)
#define     lcm(a,b)            (a*(b/gcd(a,b)))
#define     forn(i,n)          for(int i=0; i<n; i++)
#define     loop1(i,n)          for(int i=1; i<=n; i++)
#define     rev0(i,n)           for(int i=n-1; i>=0; i--)
#define     rev1(i,n)           for(int i=n; i>0; i--)
/*------------------------------------------------------------*/

/*----------------------Scans and Prints----------------------*/
#define     sc1(x)              scanf("%d",&x)
#define     sc2(x,y)            scanf("%d %d",&x,&y)
#define     sc3(x,y,z)          scanf("%d %d %d",&x,&y,&z)
#define     scd1(x)             scanf("%lld",&x)
#define     scd2(x,y)           scanf("%lld %lld",&x,&y)
#define     pf1(x)              printf("%d\n",x)
#define     pf2(x,y)            printf("%d %d\n",x,y)
#define     pfd1(x)             printf("%lld\n",x)
#define     pfd2(x,y)           printf("%lld %lld\n",x,y)
#define     t_case(t)           for(int cs = 1; cs<=t; cs++)
#define     print(a,n)          for(int pr = 0; pr<int(n); pr++)cout<<a[pr]<<" ";cout<<endl
#define     printa(x)           cout<<x<<endl;
#define     debug               cout<<" OK "<<endl
/*------------------------------------------------------------*/

int main()
{
	//FASTIO
	ll t;
	cin>>t;
	while(t--)
	{
	ll n;
	cin>>n;
	ll x;
	cin>>x;
	vll a(n);
	ll yes=0;
	vll odd;
	vll even;
	forn(i,n)
	{
	cin>>a[i];
	if(a[i]%2==1)
		odd.pb(a[i]);
	else
		even.pb(a[i]);
	}
	if(odd.size()==0)
	{
		cout<<"No"<<endl;
		continue;
	}
	ll k=1;
	ll ko=0;
	x=x-1;

	while(x>0)
	{
		if(even.size()!=ko)
		{
			++ko;
			--x;
		}
		else if(odd.size()-1>=k+2)
		{
			k+=2;
			x-=2;
		}
		else
			break;
	}
	if(x==0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}
}


#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
*/

using namespace std;

/*--------------------------Containers------------------------*/
typedef     long long int           ll;
typedef     unsigned long long int  ull;
typedef     vector < int >          vi;
typedef     vector < ll >           vll;
typedef     vector < vi >           vvi;
typedef     pair< int,int >         pi;
typedef     pair< ll, ll >          pll;
typedef     vector< pi >            vpi;
typedef     vector< pll >           vpll;
/*------------------------------------------------------------*/

/*--------------------------Limits & Constants----------------*/
#define     MAX                 200007
#define     MOD                 int(1e9+7)
#define     INF                 ll(8230219982008199610)
#define     MINF                ll(-8230219982008199610)
#define     IL                  INT_MAX
#define     MIL                 INT_MIN
#define     PI                  2*acos(0.0)
/*------------------------------------------------------------*/

/*--------------------------Macros----------------------------*/
#define     fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define     pf                  printf
#define     sc                  scanf
#define     all(a)              (a).begin(),(a).end()
#define     sz(x)               int(x.size())
#define     pb                  push_back
#define     eb                  emplace_back
#define     mp                  make_pair
#define     ff                  first
#define     ss                  second
#define     mem(a,n)            memset(a, n, sizeof(a) )
#define     gcd(a,b)            __gcd(a,b)
#define     lcm(a,b)            (a*(b/gcd(a,b)))
#define     forn(i,n)          for(int i=0; i<n; i++)
#define     loop1(i,n)          for(int i=1; i<=n; i++)
#define     rev0(i,n)           for(int i=n-1; i>=0; i--)
#define     rev1(i,n)           for(int i=n; i>0; i--)
/*------------------------------------------------------------*/

/*----------------------Scans and Prints----------------------*/
#define     sc1(x)              scanf("%d",&x)
#define     sc2(x,y)            scanf("%d %d",&x,&y)
#define     sc3(x,y,z)          scanf("%d %d %d",&x,&y,&z)
#define     scd1(x)             scanf("%lld",&x)
#define     scd2(x,y)           scanf("%lld %lld",&x,&y)
#define     pf1(x)              printf("%d\n",x)
#define     pf2(x,y)            printf("%d %d\n",x,y)
#define     pfd1(x)             printf("%lld\n",x)
#define     pfd2(x,y)           printf("%lld %lld\n",x,y)
#define     t_case(t)           for(int cs = 1; cs<=t; cs++)
#define     print(a,n)          for(int pr = 0; pr<int(n); pr++)cout<<a[pr]<<" ";cout<<endl
#define     printa(x)           cout<<x<<endl;
#define     debug               cout<<" OK "<<endl
/*------------------------------------------------------------*/

int main()
{
	//FASTIO
	ll t;
	cin>>t;
	while(t--)
	{
	ll n;
	cin>>n;
	ll x;
	cin>>x;
	vll a(n);
	ll yes=0;
	forn(i,n)
	{
	cin>>a[i];
	if(a[i]%2==1)
		++yes;
	}
	ll even = n-yes;
	if(yes<=x)
	{
	if(yes%2==1)
	{
		cout<<"Yes"<<endl;
	}
	else
		cout<<"No"<<endl;
 	}

 else
 {
 	ll even =n-yes;
 	if(even==0)
 	{
 		if(x%2==1)
 		{
 			cout<<"Yes"<<endl;
 		}
 		else
 		{
 			cout<<"No"<<endl;
 		}
 	}
 	else
 	{
 		cout<<"Yes"<<endl;
 	}
 }
}
}


#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
*/

using namespace std;

/*--------------------------Containers------------------------*/
typedef     long long int           ll;
typedef     unsigned long long int  ull;
typedef     vector < int >          vi;
typedef     vector < ll >           vll;
typedef     vector < vi >           vvi;
typedef     pair< int,int >         pi;
typedef     pair< ll, ll >          pll;
typedef     vector< pi >            vpi;
typedef     vector< pll >           vpll;
/*------------------------------------------------------------*/

/*--------------------------Limits & Constants----------------*/
#define     MAX                 200007
#define     MOD                 int(1e9+7)
#define     INF                 ll(8230219982008199610)
#define     MINF                ll(-8230219982008199610)
#define     IL                  INT_MAX
#define     MIL                 INT_MIN
#define     PI                  2*acos(0.0)
/*------------------------------------------------------------*/

/*--------------------------Macros----------------------------*/
#define     fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define     pf                  printf
#define     sc                  scanf
#define     all(a)              (a).begin(),(a).end()
#define     sz(x)               int(x.size())
#define     pb                  push_back
#define     eb                  emplace_back
#define     mp                  make_pair
#define     ff                  first
#define     ss                  second
#define     mem(a,n)            memset(a, n, sizeof(a) )
#define     gcd(a,b)            __gcd(a,b)
#define     lcm(a,b)            (a*(b/gcd(a,b)))
#define     forn(i,n)          for(int i=0; i<n; i++)
#define     loop1(i,n)          for(int i=1; i<=n; i++)
#define     rev0(i,n)           for(int i=n-1; i>=0; i--)
#define     rev1(i,n)           for(int i=n; i>0; i--)
/*------------------------------------------------------------*/

/*----------------------Scans and Prints----------------------*/
#define     sc1(x)              scanf("%d",&x)
#define     sc2(x,y)            scanf("%d %d",&x,&y)
#define     sc3(x,y,z)          scanf("%d %d %d",&x,&y,&z)
#define     scd1(x)             scanf("%lld",&x)
#define     scd2(x,y)           scanf("%lld %lld",&x,&y)
#define     pf1(x)              printf("%d\n",x)
#define     pf2(x,y)            printf("%d %d\n",x,y)
#define     pfd1(x)             printf("%lld\n",x)
#define     pfd2(x,y)           printf("%lld %lld\n",x,y)
#define     t_case(t)           for(int cs = 1; cs<=t; cs++)
#define     print(a,n)          for(int pr = 0; pr<int(n); pr++)cout<<a[pr]<<" ";cout<<endl
#define     printa(x)           cout<<x<<endl;
#define     debug               cout<<" OK "<<endl
/*------------------------------------------------------------*/

int main()
{
	//FASTIO
	ll t;
	cin>>t;
	while(t--)
	{
	ll n;
	cin>>n;
	ll x;
	cin>>x;
	vll a(n);
	ll yes=0;
	forn(i,n)
	{
	cin>>a[i];
	if(a[i]%2==1)
		++yes;
	}
	ll even = n-yes;
	if(yes<x)
	{
	if(yes%2==1)
	{
		cout<<"Yes"<<endl;
	}
	else
		cout<<"No"<<endl;
 	}

 else
 {
 	ll even =n-yes;
 	if(even==0)
 	{
 		if(x%2==1)
 		{
 			cout<<"Yes"<<endl;
 		}
 		else
 		{
 			cout<<"No"<<endl;
 		}
 	}
 	else
 	{
 		cout<<"Yes"<<endl;
 	}
 }
}
}


#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
*/

using namespace std;

/*--------------------------Containers------------------------*/
typedef     long long int           ll;
typedef     unsigned long long int  ull;
typedef     vector < int >          vi;
typedef     vector < ll >           vll;
typedef     vector < vi >           vvi;
typedef     pair< int,int >         pi;
typedef     pair< ll, ll >          pll;
typedef     vector< pi >            vpi;
typedef     vector< pll >           vpll;
/*------------------------------------------------------------*/

/*--------------------------Limits & Constants----------------*/
#define     MAX                 200007
#define     MOD                 int(1e9+7)
#define     INF                 ll(8230219982008199610)
#define     MINF                ll(-8230219982008199610)
#define     IL                  INT_MAX
#define     MIL                 INT_MIN
#define     PI                  2*acos(0.0)
/*------------------------------------------------------------*/

/*--------------------------Macros----------------------------*/
#define     fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define     pf                  printf
#define     sc                  scanf
#define     all(a)              (a).begin(),(a).end()
#define     sz(x)               int(x.size())
#define     pb                  push_back
#define     eb                  emplace_back
#define     mp                  make_pair
#define     ff                  first
#define     ss                  second
#define     mem(a,n)            memset(a, n, sizeof(a) )
#define     gcd(a,b)            __gcd(a,b)
#define     lcm(a,b)            (a*(b/gcd(a,b)))
#define     forn(i,n)          for(int i=0; i<n; i++)
#define     loop1(i,n)          for(int i=1; i<=n; i++)
#define     rev0(i,n)           for(int i=n-1; i>=0; i--)
#define     rev1(i,n)           for(int i=n; i>0; i--)
/*------------------------------------------------------------*/

/*----------------------Scans and Prints----------------------*/
#define     sc1(x)              scanf("%d",&x)
#define     sc2(x,y)            scanf("%d %d",&x,&y)
#define     sc3(x,y,z)          scanf("%d %d %d",&x,&y,&z)
#define     scd1(x)             scanf("%lld",&x)
#define     scd2(x,y)           scanf("%lld %lld",&x,&y)
#define     pf1(x)              printf("%d\n",x)
#define     pf2(x,y)            printf("%d %d\n",x,y)
#define     pfd1(x)             printf("%lld\n",x)
#define     pfd2(x,y)           printf("%lld %lld\n",x,y)
#define     t_case(t)           for(int cs = 1; cs<=t; cs++)
#define     print(a,n)          for(int pr = 0; pr<int(n); pr++)cout<<a[pr]<<" ";cout<<endl
#define     printa(x)           cout<<x<<endl;
#define     debug               cout<<" OK "<<endl
/*------------------------------------------------------------*/

int main()
{
	//FASTIO
	ll t;
	cin>>t;
	while(t--)
	{
	ll n;
	cin>>n;
	ll x;
	cin>>x;
	vll a(n);
	ll yes=0;
	forn(i,n)
	{
	cin>>a[i];
	if(a[i]%2==1)
		++yes;
	}
	ll even = n-yes;
	if(yes%2==1)
	{
		cout<<"Yes"<<endl;
	}
	else
		cout<<"No"<<endl;
 	}

}


#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

string solve(int &n, int &x, int &countOdd){
	if (countOdd == 0){
		return "No";
	}
	if (x==n){
		return (countOdd%2==1)?"Yes":"No";
	}
	if (x > countOdd){
		return "Yes";
	}
	if (x%2==0 && countOdd==n)
		return "No";

	return "Yes";

}
//x = 5, cO = 2, n = 6;
int main(){
	int t;
	cin>>t;
	ostringstream oss;
	for (int i=0;i<t;i++){
		int n,x;
		cin>>n>>x;
		vector<int> a;
		int countOdd=0;
		for(int j=0;j<n;j++){
			int tmp;
			cin>>tmp;
			countOdd += (tmp%2);

		}
		oss<<solve(n,x,countOdd)<<endl;
	}
	cout<<oss.str();

	return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

string solve(int n, int x, vector<int> &a){
	int countOdd = 0;
	for(int i=0;i<n;i++){
		countOdd += a[i];
	}
	int countEven = n-countOdd;
	if (x%2==1){
		if (countOdd >= 1){
			return "Yes";
		}
		return "No";
	}
	else{
		if (countOdd >= 1 && countEven >= 1){
			return "Yes";
		}
		return "No";
	}
	return "No";

}

int main(){
	int t;
	cin>>t;
	ostringstream oss;
	for (int i=0;i<t;i++){
		int n,x;
		cin>>n>>x;
		vector<int> a;
		for(int j=0;j<n;j++){
			int tmp;
			cin>>tmp;
			a.push_back(tmp%2);
		}
		oss<<solve(n,x,a)<<endl;
	}
	cout<<oss.str();

	return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

string solve(int n, int x, vector<int> &a){
	int countOdd = 0;
	for(int i=0;i<n;i++){
		countOdd += a[i];
	}
	if (countOdd == 0){
		return "No";
	}
	if (x==n){
		return (countOdd%2==1)?"Yes":"No";
	}
	if (x > countOdd){
		return "Yes";
	}
	if (x%2==0 && countOdd==n)
		return "No";

	return "Yes";

}
//x = 5, cO = 2, n = 6;
int main(){
	int t;
	cin>>t;
	ostringstream oss;
	for (int i=0;i<t;i++){
		int n,x;
		cin>>n>>x;
		vector<int> a;
		for(int j=0;j<n;j++){
			int tmp;
			cin>>tmp;
			a.push_back(tmp%2);
		}
		oss<<solve(n,x,a)<<endl;
	}
	cout<<oss.str();

	return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

string solve(int &n, int &x, int &countOdd){
	if (countOdd == 0)
		return "No";
	if (x==n)
		return (countOdd%2==1)?"Yes":"No";
	if (x > countOdd)
		return "Yes";
	if (x%2==0 && countOdd==n)
		return "No";
	return "Yes";
}
//x = 5, cO = 2, n = 6;
int main(){
	int t;
	cin>>t;
	ostringstream oss;
	for (int i=0;i<t;i++){
		int n,x;
		cin>>n>>x;
		vector<int> a;
		int countOdd=0;
		for(int j=0;j<n;j++){
			int tmp;
			cin>>tmp;
			countOdd += (tmp%2);

		}
		oss<<solve(n,x,countOdd)<<endl;
	}
	cout<<oss.str();

	return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

string solve(int n, int x, vector<int> &a){
	int countOdd = 0;
	for(int i=0;i<n;i++){
		countOdd += a[i];
	}
	if (countOdd == 0){
		return "No";
	}
	int countEven = n-countOdd;
	if (x==n){
		return (countOdd%2==1)?"Yes":"No";
	}
	if (x==countOdd){
		if (x%2==0)
			return "No";
		return "Yes";
	}
	else if (x > countOdd){
		return "Yes";
	}
	else{
		if (countEven==0 && x%2==0){
			return "No";
		}
	}
	return "Yes";

}
//x = 5, cO = 2, n = 6;
int main(){
	int t;
	cin>>t;
	ostringstream oss;
	for (int i=0;i<t;i++){
		int n,x;
		cin>>n>>x;
		vector<int> a;
		for(int j=0;j<n;j++){
			int tmp;
			cin>>tmp;
			a.push_back(tmp%2);
		}
		oss<<solve(n,x,a)<<endl;
	}
	cout<<oss.str();

	return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

string solve(int n, int x, vector<int> &a){
	int countOdd = 0;
	for(int i=0;i<n;i++){
		countOdd += a[i];
	}
	if (countOdd == 0){
		return "No";
	}
	if (x==n){
		return (countOdd%2==1)?"Yes":"No";
	}
	if (x<=countOdd){
		if (x%2==0 && countOdd==n)
			return "No";
		return "Yes";
	}

	return "Yes";

}
//x = 5, cO = 2, n = 6;
int main(){
	int t;
	cin>>t;
	ostringstream oss;
	for (int i=0;i<t;i++){
		int n,x;
		cin>>n>>x;
		vector<int> a;
		for(int j=0;j<n;j++){
			int tmp;
			cin>>tmp;
			a.push_back(tmp%2);
		}
		oss<<solve(n,x,a)<<endl;
	}
	cout<<oss.str();

	return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

string solve(int n, int x, vector<int> &a){
	int countOdd = 0;
	for(int i=0;i<n;i++){
		countOdd += a[i];
	}
	if (countOdd == 0){
		return "No";
	}
	int countEven = n-countOdd;
	if (x==n){
		return (countOdd%2==1)?"Yes":"No";
	}
	if (x==countOdd){
		if (x%2==0)
			return "No";
		return "Yes";
	}
	else if (x > countOdd){
		return "Yes";
	}
	return "No";

}
//x = 5, cO = 2, n = 6;
int main(){
	int t;
	cin>>t;
	ostringstream oss;
	for (int i=0;i<t;i++){
		int n,x;
		cin>>n>>x;
		vector<int> a;
		for(int j=0;j<n;j++){
			int tmp;
			cin>>tmp;
			a.push_back(tmp%2);
		}
		oss<<solve(n,x,a)<<endl;
	}
	cout<<oss.str();

	return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

string solve(int n, int x, vector<int> &a){
	int countOdd = 0;
	for(int i=0;i<n;i++){
		countOdd += a[i];
	}
	if (countOdd == 0){
		return "No";
	}
	int countEven = n-countOdd;
	if (x==n){
		return (countOdd%2==1)?"Yes":"No";
	}
	if (x==countOdd){
		if (x%2==0 && countEven==0)
			return "No";
		return "Yes";
	}
	else if (x > countOdd){
		return "Yes";
	}
	else{
		if (countEven==0 && x%2==0){
			return "No";
		}
	}
	return "Yes";

}
//x = 5, cO = 2, n = 6;
int main(){
	int t;
	cin>>t;
	ostringstream oss;
	for (int i=0;i<t;i++){
		int n,x;
		cin>>n>>x;
		vector<int> a;
		for(int j=0;j<n;j++){
			int tmp;
			cin>>tmp;
			a.push_back(tmp%2);
		}
		oss<<solve(n,x,a)<<endl;
	}
	cout<<oss.str();

	return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

string solve(int n, int x, vector<int> &a){
	int countOdd = 0;
	for(int i=0;i<n;i++){
		countOdd += a[i];
	}
	if (countOdd == 0){
		return "No";
	}
	int countEven = n-countOdd;
	if (x==n){
		return (countOdd%2==1)?"Yes":"No";
	}
	if (x==countOdd){
		if (x%2==0)
			return "No";
		return "Yes";
	}
	else if (x > countOdd){
		return "Yes";
	}
	return "Yes";

}
//x = 5, cO = 2, n = 6;
int main(){
	int t;
	cin>>t;
	ostringstream oss;
	for (int i=0;i<t;i++){
		int n,x;
		cin>>n>>x;
		vector<int> a;
		for(int j=0;j<n;j++){
			int tmp;
			cin>>tmp;
			a.push_back(tmp%2);
		}
		oss<<solve(n,x,a)<<endl;
	}
	cout<<oss.str();

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
        }
        if (x % 2 == 0 && odds >= x && odds == n)
            cout << "No" << endl;
        else if (odds < x && x == n && odds % 2 == 0)
            cout << "No" << endl;
        else if (!odds)
            cout << "No" << endl;
        else
            cout << "Yes" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds == 0)
            cout << "No" << endl;
        else if (evens == 0 && x % 2 == 0)
            cout << "No" << endl;
        else if (evens >= x && odds >= 1)
             cout << "Yes" << endl;
        else
        {
            x-= evens;
            if (x % 2 == 0) x++;
            if (odds >= x)
                cout << "Yes" << endl;
            else
                cout << "No" << endl;
        }
    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds >= x && x % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >= x && evens >= 1)
            cout << "Yes" << endl;
        else if (odds < x && odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds < x && evens >= (x - odds + 1))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >=x && evens >=1)
            cout << "Yes" << endl;
        else if (odds < x && x != n & odds != 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds >= x && x % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >= x && evens >= 1)
            cout << "Yes" << endl;
        else if (odds < x && odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds && odds < x && n >= (x - 1))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds >= x && x % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >= x && x <= n- 1)
            cout << "Yes" << endl;
        else if (odds < x && odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds && odds < x && x <= n-1)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds >= x && x % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >= x && odds <= n-1)
            cout << "Yes" << endl;
        else if (odds < x && odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds && odds < x && x <= n-1)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds >= x && x % 2 == 1)
            cout << "Yes" << endl;
        else if (odds && x <= n- 1)
            cout << "Yes" << endl;
        else if (odds < x && odds % 2 == 1)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds == 0)
            cout << "No" << endl;
        else if (odds >= x && x % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >= x && evens >= 1)
            cout << "Yes" << endl;
        else if (odds < x && odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds < x && evens >= (x - odds + 1))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >=x && (evens >=1 || x % 2 == 1))
            cout << "Yes" << endl;
        else if (odds < x && x != n & odds != 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
        }
        if (x % 2 == 0 && odds >= x && odds == n)
            cout << "No" << endl;
        else if (odds < x && x == n && odds % 2 == 0)
            cout << "No" << endl;
        else
            cout << "Yes" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
        }
        if (x % 2 == 0 && odds > x && odds == n)
            cout << "No" << endl;
        else if (odds < x && x == n && odds % 2 == 0)
            cout << "No" << endl;
        else if (!odds)
            cout << "No" << endl;
        else
            cout << "Yes" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds == 0)
            cout << "No" << endl;
        if (odds >= x && x % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >= x && evens >= 1)
            cout << "Yes" << endl;
        else if (odds < x && odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds < x && evens >= (x - odds + 1))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >=x && (evens >=1 || odds == x))
            cout << "Yes" << endl;
        else if (odds < x && x != n & odds != 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds >= x && x % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >= x && evens >= 1)
            cout << "Yes" << endl;
        else if (odds < x && odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds && odds < x && x <= n-1)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds % 2 == 1 && odds >= x)
            cout << "Yes" << endl;
        else if (odds >=x && evens >=1)
            cout << "Yes" << endl;
        else if (odds < x && odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds < x && x != n)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds == 0)
            cout << "No" << endl;
        else if (odds >= x && x % 2 == 1)
            cout << "Yes" << endl;
        else if (odds >= x && evens >= 1)
            cout << "Yes" << endl;
        else if (odds < x && odds % 2 == 1)
            cout << "Yes" << endl;
        else if (odds < x && x <= n-1)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        int evens = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
            else
                evens++;
        }
        if (odds == 0)
        {
            cout << "No" << endl;
            continue;
        }
        if (evens == 0 && x % 2 == 0)
        {
            cout << "No" << endl;
            continue;
        }
        if (evens >= x)
        {
            if (odds >=1)
            {
                cout << "Yes" << endl;
                continue;
            }

        }
        else
        {
            x-= evens;
            if (x % 2 == 0) x++;
            if (odds >= x)
            {
                cout << "Yes" << endl;
                continue;
            }
        }
        cout << "No" << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = std::pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>; //vector<vector<int>>
using vs = vector<string>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)((x).size())
#define arrsz(x) (int) (sizeof((x))/sizeof((x)[0]))

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

/* Usage: output_vector(solution), which prints elements with spaces and then new line*/
template<typename T>
void output_vector(const vector<T> &v, int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());

    for (int i = start; i < end; i++)
        cout << v[i] << " ";
    cout << endl;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int n, x;
        cin >> n >> x;
        int odds = 0;
        for (int i = 0; i < n; i++)
        {
            int num;
            cin >> num;
            if (num % 2 == 1)
                odds++;
        }
        if (x % 2 == 0 && odds == n)
            cout << "No" << endl;
        else if (x == n && odds % 2 == 0)
            cout << "No" << endl;
        else if (!odds)
            cout << "No" << endl;
        else
            cout << "Yes" << endl;

    }
}


///*Bismillahir Rahmanir Rahim***///
///**Author Thasin Sheikh**///
/*    #include <regex>
    ...
    std::string string("hello $name");
    string = std::regex_replace(string, std::regex("\\$name"), "Somename");
    */
#include<bits/stdc++.h>
using namespace std;
vector<int>primes;
#define MAX 35000
#define makefast__  ios_base::sync_with_stdio(false);
using ll=long long int  ;
using dl =double;
ll aarray[200000+10];
ll magic[501][501];
ll ar[200000+10];
ll vi[40000+10];
ll  a,b;
int main()
{
    makefast__
    string ptr,str;
    ll m1,m2,m3,m4,i,j,n,k,m5,l,m,r,ta,t,flag,g,nmpo,hariken,sum=0,ans=0;
    ll w1,w2,w3,w4,w5;
    vector<ll>dvi;
    /*bool primes[1000007];
    memset(primes,true,sizeof(primes));
    primes[0]=primes[1]=false;
    for(i=2; i<=100001; i++)
    {
        if(primes[i])
        {
            for(j=i*2; j<=n; j+=i)
            {
                primes[j]=false;
            }
        }
    }*/
    cin>>t;
    while(t--)
    {
        ll bjor=0,jor;
        cin>>n>>m1;
        for(i=0; i<n; i++)
        {
            cin>>a;
            if(a%2!=0)
                bjor++;
                else jor++;
        }
        if(bjor%2!=0&&m1<=n)
            cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }

}


///*Bismillahir Rahmanir Rahim***///
///**Author Thasin Sheikh**///
/*    #include <regex>
    ...
    std::string string("hello $name");
    string = std::regex_replace(string, std::regex("\\$name"), "Somename");
    */
#include<bits/stdc++.h>
using namespace std;
vector<int>primes;
#define MAX 35000
#define makefast__  ios_base::sync_with_stdio(false);
using ll=long long int  ;
using dl =double;
ll aarray[200000+10];
ll magic[501][501];
ll ar[200000+10];
ll vi[40000+10];
ll  a,b;
int main()
{
    makefast__
    string ptr,str;
    ll m1,m2,m3,m4,i,j,n,k,m5,l,m,r,ta,t,flag,g,nmpo,hariken,sum=0,ans=0;
    ll w1,w2,w3,w4,w5;
    vector<ll>dvi;
    /*bool primes[1000007];
    memset(primes,true,sizeof(primes));
    primes[0]=primes[1]=false;
    for(i=2; i<=100001; i++)
    {
        if(primes[i])
        {
            for(j=i*2; j<=n; j+=i)
            {
                primes[j]=false;
            }
        }
    }*/
    cin>>t;
    while(t--)
    {
        ll bjor=0,jor=0;
        cin>>n>>m1;
        for(i=0; i<n; i++)
        {
            cin>>a;
            if(a%2!=0)
                bjor++;
            else jor++;
        }
        if(bjor==0)
            cout<<"NO"<<endl;
        else if(bjor%2!=0&&jor>=1)
            cout<<"YES"<<endl;
        else if(bjor%2!=0&&bjor==n&&m1%2!=0)
        {
            cout<<"YES"<<endl;
        }
        else if(bjor%2==0&&m1!=n&&m1%2!=0)
            cout<<"YES"<<endl;
        else if(bjor%2==0&&jor>=1&&m1!=n)
        {
            cout<<"YES"<<endl;
        }
        else cout<<"NO"<<endl;

    }
}


///*Bismillahir Rahmanir Rahim***///
///**Author Thasin Sheikh**///
/*    #include <regex>
    ...
    std::string string("hello $name");
    string = std::regex_replace(string, std::regex("\\$name"), "Somename");
    */
#include<bits/stdc++.h>
using namespace std;
vector<int>primes;
#define MAX 35000
#define makefast__  ios_base::sync_with_stdio(false);
using ll=long long int  ;
using dl =double;
ll aarray[200000+10];
ll magic[501][501];
ll ar[200000+10];
ll vi[40000+10];
ll  a,b;
int main()
{
    makefast__
    string ptr,str;
    ll m1,m2,m3,m4,i,j,n,k,m5,l,m,r,ta,t,flag,g,nmpo,hariken,sum=0,ans=0;
    ll w1,w2,w3,w4,w5;
    vector<ll>dvi;
    /*bool primes[1000007];
    memset(primes,true,sizeof(primes));
    primes[0]=primes[1]=false;
    for(i=2; i<=100001; i++)
    {
        if(primes[i])
        {
            for(j=i*2; j<=n; j+=i)
            {
                primes[j]=false;
            }
        }
    }*/
    cin>>t;
    while(t--)
    {
        ll bjor=0,jor=0;
        cin>>n>>m1;
        for(i=0; i<n; i++)
        {
            cin>>a;
            if(a%2!=0)
                bjor++;
            else jor++;
        }
        if(bjor%2==0&&m1!=n)
        {
            cout<<"YES"<<endl;
        }
        else if(bjor%2!=0&&m1<=bjor&&m1%2!=0)
            cout<<"YES"<<endl;
        else if(m1%2==0&&bjor>=1&&jor>=1)
        {
            cout<<"YES"<<endl;
        }
        else cout<<"NO"<<endl;
    }

}


///*Bismillahir Rahmanir Rahim***///
///**Author Thasin Sheikh**///
/*    #include <regex>
    ...
    std::string string("hello $name");
    string = std::regex_replace(string, std::regex("\\$name"), "Somename");
    */
#include<bits/stdc++.h>
using namespace std;
vector<int>primes;
#define MAX 35000
#define makefast__  ios_base::sync_with_stdio(false);
using ll=long long int  ;
using dl =double;
ll aarray[200000+10];
ll magic[501][501];
ll ar[200000+10];
ll vi[40000+10];
ll  a,b;
int main()
{
    makefast__
    string ptr,str;
    ll m1,m2,m3,m4,i,j,n,k,m5,l,m,r,ta,t,flag,g,nmpo,hariken,sum=0,ans=0;
    ll w1,w2,w3,w4,w5;
    vector<ll>dvi;
    /*bool primes[1000007];
    memset(primes,true,sizeof(primes));
    primes[0]=primes[1]=false;
    for(i=2; i<=100001; i++)
    {
        if(primes[i])
        {
            for(j=i*2; j<=n; j+=i)
            {
                primes[j]=false;
            }
        }
    }*/
    cin>>t;
    while(t--)
    {
        ll bjor=0,jor=0;
        cin>>n>>m1;
        for(i=0; i<n; i++)
        {
            cin>>a;
            if(a%2!=0)
                bjor++;
            else jor++;
        }
        if(bjor%2!=0&&jor>=1)
            cout<<"YES"<<endl;
        else if(bjor%2!=0&&m1%2==0&&jor>=1)
        {
            cout<<"YES"<<endl;
        }
        else if(bjor%2==0&&m1<n&&m1%2!=0)
        {
            cout<<"YES"<<endl;
        }
        else if(bjor%2==0&&bjor!=n&&m1!=n){
                cout<<"YES"<<endl;

        }
        else if(bjor%2!=0&&m1%2!=0)
            cout<<"YES"<<endl;
        else cout<<"NO"<<endl;

    }
}