///*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%2!=0&&bjor>=m1)
            cout<<"YES"<<endl;
        else if(n%2!=0&&bjor%2!=0)
        {
            cout<<"YES"<<endl;
        }
        else if(bjor%2==0&&m1<n)
        {
            cout<<"YES"<<endl;
        }
        else if(bjor%2!=0&&bjor<=m1)
            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)
        {
            cout<<"YES"<<endl;
        }
        else if(bjor%2!=0&&m1%2!=0)
            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%2!=0)
            cout<<"YES"<<endl;
        else if(bjor%2!=0&&m1%2==0&&jor>=1)
        {
            cout<<"YES"<<endl;
        }
        else 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%2!=0&&m1<=n)
            cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }

}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;

#define sc scanf
#define ls rt << 1
#define rs ls | 1
#define Min(x, y) x = min(x, y)
#define Max(x, y) x = max(x, y)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pir pair <int, int>
#define MK(x, y) make_pair(x, y)
#define MEM(x, b) memset(x, b, sizeof(x))
#define MPY(x, b) memcpy(x, b, sizeof(x))
#define lowbit(x) ((x) & -(x))
#define P2(x) ((x) * (x))

typedef long long ll;
const int Mod = 1e9 + 7;
const int N = 2e5 + 100;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % Mod; b >>= 1; t = (t*t) % Mod; }return r; }
inline ll fpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t); b >>= 1; t = (t*t); }return r; }

int a[N];

int main()
{
	int T; cin >> T;
	while (T--) {
		int n, x;
		sc("%d %d", &n, &x);
		int cnt = 0, cnt2 = 0;
		for (int i = 1; i <= n; i++) {
			sc("%d", &a[i]);
			if (a[i] & 1)
				cnt++;
			else
				cnt2++;
		}
		if (!cnt) { printf("No\n"); continue; }
		if (x & 1) {
			x--;
			if (x <= cnt2)
				printf("Yes\n");
			else {
				if ((x - cnt2) & 1)
					printf("No\n");
				else
					printf("Yes\n");
			}
		}
		else {
			x--;
			if (x <= cnt2)
				printf("Yes\n");
			else {
				if ((x - cnt2) % 2 == 0)
					printf("No\n");
				else
					printf("Yes\n");
			}
		}
	}
	return 0;  // 改数组大小!!!用pair记得改宏定义!!!
}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;

#define sc scanf
#define ls rt << 1
#define rs ls | 1
#define Min(x, y) x = min(x, y)
#define Max(x, y) x = max(x, y)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pir pair <int, int>
#define MK(x, y) make_pair(x, y)
#define MEM(x, b) memset(x, b, sizeof(x))
#define MPY(x, b) memcpy(x, b, sizeof(x))
#define lowbit(x) ((x) & -(x))
#define P2(x) ((x) * (x))

typedef long long ll;
const int Mod = 1e9 + 7;
const int N = 2e5 + 100;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % Mod; b >>= 1; t = (t*t) % Mod; }return r; }
inline ll fpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t); b >>= 1; t = (t*t); }return r; }

int a[N];

int main()
{
	int T; cin >> T;
	while (T--) {
		int n, x;
		sc("%d %d", &n, &x);
		int cnt = 0, cnt2 = 0;
		for (int i = 1; i <= n; i++) {
			sc("%d", &a[i]);
			if (a[i] & 1)
				cnt++;
			else
				cnt2++;
		}
		if (!cnt) { printf("No\n"); continue; }
		if (x & 1) {
			if (cnt >= x)
				printf("Yes\n");
			else {
				x--;
				if (cnt2 >= x)
					printf("Yes\n");
				else {
					if ((x - cnt2) % 2 == 0)
						printf("Yes\n");
					else
						printf("No\n");
				}
			}
		}
		else {
			x--;
			if (cnt2 >= x)
				printf("Yes\n");
			else {
				if ((x - cnt2) % 2 == 0)
					printf("Yes\n");
				else
					printf("No\n");
			}
		}
	}
	return 0;  // 改数组大小!!!用pair记得改宏定义!!!
}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;

#define sc scanf
#define ls rt << 1
#define rs ls | 1
#define Min(x, y) x = min(x, y)
#define Max(x, y) x = max(x, y)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pir pair <int, int>
#define MK(x, y) make_pair(x, y)
#define MEM(x, b) memset(x, b, sizeof(x))
#define MPY(x, b) memcpy(x, b, sizeof(x))
#define lowbit(x) ((x) & -(x))
#define P2(x) ((x) * (x))

typedef long long ll;
const int Mod = 1e9 + 7;
const int N = 2e5 + 100;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % Mod; b >>= 1; t = (t*t) % Mod; }return r; }
inline ll fpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t); b >>= 1; t = (t*t); }return r; }

int a[N];

int main()
{
	int T; cin >> T;
	while (T--) {
		int n, x;
		sc("%d %d", &n, &x);
		int even = 0, odd = 0;
		for (int i = 1; i <= n; i++) {
			sc("%d", &a[i]);
			if (a[i] & 1)
				odd++;
			else
				even++;
		}
		if (!odd)
			printf("No\n");
		else {
			x--, odd--;
			if (even >= x)
				printf("Yes\n");
			else {
				if (odd & 1)
					printf("No\n");
				else
					printf("Yes\n");
			}
		}
	}
	return 0;  // 改数组大小!!!用pair记得改宏定义!!!
}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;

#define sc scanf
#define ls rt << 1
#define rs ls | 1
#define Min(x, y) x = min(x, y)
#define Max(x, y) x = max(x, y)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pir pair <int, int>
#define MK(x, y) make_pair(x, y)
#define MEM(x, b) memset(x, b, sizeof(x))
#define MPY(x, b) memcpy(x, b, sizeof(x))
#define lowbit(x) ((x) & -(x))
#define P2(x) ((x) * (x))

typedef long long ll;
const int Mod = 1e9 + 7;
const int N = 2e5 + 100;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % Mod; b >>= 1; t = (t*t) % Mod; }return r; }
inline ll fpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t); b >>= 1; t = (t*t); }return r; }

int a[N];

int main()
{
	int T; cin >> T;
	while (T--) {
		int n, x;
		sc("%d %d", &n, &x);
		int cnt = 0, cnt2 = 0;
		for (int i = 1; i <= n; i++) {
			sc("%d", &a[i]);
			if (a[i] & 1)
				cnt++;
			else
				cnt2++;
		}
		if (!cnt) { printf("No\n"); continue; }
		x--;
		if (x <= cnt2)
			printf("Yes\n");
		else {
			if ((x - cnt2) & 1)
				printf("No\n");
			else
				printf("Yes\n");
		}
	}
	return 0;  // 改数组大小!!!用pair记得改宏定义!!!
}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;

#define sc scanf
#define ls rt << 1
#define rs ls | 1
#define Min(x, y) x = min(x, y)
#define Max(x, y) x = max(x, y)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pir pair <int, int>
#define MK(x, y) make_pair(x, y)
#define MEM(x, b) memset(x, b, sizeof(x))
#define MPY(x, b) memcpy(x, b, sizeof(x))
#define lowbit(x) ((x) & -(x))
#define P2(x) ((x) * (x))

typedef long long ll;
const int Mod = 1e9 + 7;
const int N = 2e5 + 100;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % Mod; b >>= 1; t = (t*t) % Mod; }return r; }
inline ll fpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t); b >>= 1; t = (t*t); }return r; }

int a[N];

int main()
{
	int T; cin >> T;
	while (T--) {
		int n, x;
		sc("%d %d", &n, &x);
		int even = 0, odd = 0;
		for (int i = 1; i <= n; i++) {
			sc("%d", &a[i]);
			if (a[i] & 1)
				odd++;
			else
				even++;
		}
		if (x & 1) {
			if (odd >= x)
				printf("Yes\n");
			else {
				int tot;
				if (odd & 1)
					tot = odd;
				else
					tot = odd - 1;
				x -= tot;
				if (even >= x)
					printf("Yes\n");
				else
					printf("No\n");
			}
		}
		else {
			if (!even)
				printf("No\n");
			else {
				x--, even--;
				if (odd >= x)
					printf("Yes\n");
				else {
					int tot;
					if (odd & 1)
						tot = odd;
					else
						tot = odd - 1;
					x -= tot;
					if (even >= x)
						printf("Yes\n");
					else
						printf("No\n");
				}
			}
		}
	}
	return 0;  // 改数组大小!!!用pair记得改宏定义!!!
}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;

#define sc scanf
#define ls rt << 1
#define rs ls | 1
#define Min(x, y) x = min(x, y)
#define Max(x, y) x = max(x, y)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pir pair <int, int>
#define MK(x, y) make_pair(x, y)
#define MEM(x, b) memset(x, b, sizeof(x))
#define MPY(x, b) memcpy(x, b, sizeof(x))
#define lowbit(x) ((x) & -(x))
#define P2(x) ((x) * (x))

typedef long long ll;
const int Mod = 1e9 + 7;
const int N = 2e5 + 100;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % Mod; b >>= 1; t = (t*t) % Mod; }return r; }
inline ll fpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t); b >>= 1; t = (t*t); }return r; }

int a[N];

int main()
{
	int T; cin >> T;
	while (T--) {
		int n, x;
		sc("%d %d", &n, &x);
		int even = 0, odd = 0;
		for (int i = 1; i <= n; i++) {
			sc("%d", &a[i]);
			if (a[i] & 1)
				odd++;
			else
				even++;
		}
		if (!odd) { printf("No\n"); continue; }
		if (x & 1) {
			if (odd >= x)
				printf("Yes\n");
			else {
				int tot;
				if (odd & 1)
					tot = odd;
				else
					tot = odd - 1;
				x -= tot;
				if (even >= x)
					printf("Yes\n");
				else
					printf("No\n");
			}
		}
		else {
			if (!even)
				printf("No\n");
			else {
				x--, even--;
				if (odd >= x)
					printf("Yes\n");
				else {
					int tot;
					if (odd & 1)
						tot = odd;
					else
						tot = odd - 1;
					x -= tot;
					if (even >= x)
						printf("Yes\n");
					else
						printf("No\n");
				}
			}
		}
	}
	return 0;  // 改数组大小!!!用pair记得改宏定义!!!
}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;

#define sc scanf
#define ls rt << 1
#define rs ls | 1
#define Min(x, y) x = min(x, y)
#define Max(x, y) x = max(x, y)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pir pair <int, int>
#define MK(x, y) make_pair(x, y)
#define MEM(x, b) memset(x, b, sizeof(x))
#define MPY(x, b) memcpy(x, b, sizeof(x))
#define lowbit(x) ((x) & -(x))
#define P2(x) ((x) * (x))

typedef long long ll;
const int Mod = 1e9 + 7;
const int N = 2e5 + 100;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % Mod; b >>= 1; t = (t*t) % Mod; }return r; }
inline ll fpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t); b >>= 1; t = (t*t); }return r; }

int a[N];

int main()
{
	int T; cin >> T;
	while (T--) {
		int n, x;
		sc("%d %d", &n, &x);
		int even = 0, odd = 0;
		for (int i = 1; i <= n; i++) {
			sc("%d", &a[i]);
			if (a[i] & 1)
				odd++;
			else
				even++;
		}
		if (!odd)
			printf("No\n");
		else {
			x--, odd--;
			if (even >= x)
				printf("Yes\n");
			else {
				if (odd >= x)
					printf("Yes\n");
				else {
					if (odd & 1)
						printf("No\n");
					else
						printf("Yes\n");
				}
			}
		}
	}
	return 0;  // 改数组大小!!!用pair记得改宏定义!!!
}


#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;

#define sc scanf
#define ls rt << 1
#define rs ls | 1
#define Min(x, y) x = min(x, y)
#define Max(x, y) x = max(x, y)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pir pair <int, int>
#define MK(x, y) make_pair(x, y)
#define MEM(x, b) memset(x, b, sizeof(x))
#define MPY(x, b) memcpy(x, b, sizeof(x))
#define lowbit(x) ((x) & -(x))
#define P2(x) ((x) * (x))

typedef long long ll;
const int Mod = 1e9 + 7;
const int N = 2e5 + 100;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
inline ll dpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t) % Mod; b >>= 1; t = (t*t) % Mod; }return r; }
inline ll fpow(ll a, ll b){ ll r = 1, t = a; while (b){ if (b & 1)r = (r*t); b >>= 1; t = (t*t); }return r; }

int a[N];

int main()
{
	int T; cin >> T;
	while (T--) {
		int n, x;
		sc("%d %d", &n, &x);
		int cnt = 0, cnt2 = 0;
		for (int i = 1; i <= n; i++) {
			sc("%d", &a[i]);
			if (a[i] & 1)
				cnt++;
			else
				cnt2++;
		}
		if (!cnt) { printf("No\n"); continue; }
		if (x & 1) {
			x--;
			if (x <= cnt2)
				printf("Yes\n");
			else {
				if ((x - cnt2) & 1)
					printf("No\n");
				else
					printf("Yes\n");
			}
		}
		else {
			x--;
			if (x <= cnt2)
				printf("Yes\n");
			else {
				if ((x - cnt2) % 2 == 0)
					printf("Yes\n");
				else
					printf("No\n");
			}
		}
	}
	return 0;  // 改数组大小!!!用pair记得改宏定义!!!
}


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

int main()
{
    int t;
    cin>>t;
    while(t--)
        {
            int n,x,j=0,o=0;
            cin>>n>>x;
            int a[1000];
            for(int i=0;i<n;i++)
                {
                    scanf("%d",&a[i]);
                }
            sort(a,a+n);
            if(a[0]%2==0) o++;
            else j++;
            for(int i=1;i<n;i++)
                {
                    if(a[i]!=a[i-1])
                        {
                            if(a[i]%2==0) o++;
                            else j++;
                        }
                }
            if(j==0) cout<<"No"<<endl;
            else{
                   if(o+j<x) cout<<"No"<<endl;
                   else{
                         if(o+j==x)
                           {
                               if(j%2==0) cout<<"No"<<endl;
                               else cout<<"Yes"<<endl;
                            }
                         else{
                               if(j) cout<<"Yes"<<endl;
                               else cout<<"No"<<endl;
                             }
            }
            }

        }
    return 0;
}


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

int main()
{
    int t;
    cin>>t;
    while(t--)
        {
            int n,x,j=0,o=0;
            cin>>n>>x;
            int a[1000];
            for(int i=0;i<n;i++)
                {
                    scanf("%d",&a[i]);
                }
            sort(a,a+n);
            if(a[0]%2==0) o++;
            else j++;
            for(int i=1;i<n;i++)
                {
                    if(a[i]!=a[i-1])
                        {
                            if(a[i]%2==0) o++;
                            else j++;
                        }
                }
            if(o+j<x) cout<<"No"<<endl;
            else{
            if(j%2!=0)
                {
                    if(x%2==0)
                        {
                            if(o) cout<<"Yes"<<endl;
                            else cout<<"No"<<endl;
                        }
                    else cout<<"Yes"<<endl;
                }
            else
                {
                    if(o+j==x) cout<<"No"<<endl;
                    else cout<<"Yes"<<endl;

                }
            }

        }
    return 0;
}


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

int main()
{
    int t;
    cin>>t;
    while(t--)
        {
            int n,x,j=0,o=0;
            cin>>n>>x;
            int a[1000];
            for(int i=0;i<n;i++)
                {
                    scanf("%d",&a[i]);
                    if(a[i]%2==0) o++;
                    else j++;
                }
            if(j>=x)
                {
                    if(x%2==1) cout<<"Yes"<<endl;
                    else
                        {
                            if(o) cout<<"Yes"<<endl;
                            else cout<<"No"<<endl;
                        }
                }
            else{
                if(j%2==1) cout<<"Yes"<<endl;
                else
                    {
                        if(x==n) cout<<"No"<<endl;
                        else cout<<"Yes"<<endl;
                    }
            }
        }
    return 0;
}


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

int main()
{
    int t;
    cin>>t;
    while(t--)
        {
            int n,x,j=0,o=0;
            cin>>n>>x;
            int a[1000];
            for(int i=0;i<n;i++)
                {
                    scanf("%d",&a[i]);
                    if(a[i]%2==0) o++;
                    else j++;
                }
            if(j==0) cout<<"No"<<endl;
            else
                {
                    if(x==n)
                        {
                            if(j%2==0) cout<<"No"<<endl;
                            else cout<<"Yes"<<endl;
                        }
                    else{
                            if(x%2==0)
                                {
                                    if(o) cout<<"Yes"<<endl;
                                    else cout<<"No"<<endl;
                                }
                            else cout<<"Yes"<<endl;
                    }
                }
        }
    return 0;
}


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

int main()
{
    int t;
    cin>>t;
    while(t--)
        {
            int n,x,j=0,o=0;
            cin>>n>>x;
            int a[1000];
            for(int i=0;i<n;i++)
                {
                    scanf("%d",&a[i]);
                    if(a[i]%2==0) o++;
                    else j++;
                }
            if(j==0) cout<<"No"<<endl;
            else
                {
                    if(x==n)
                        {
                            if(j%2==0) cout<<"No"<<endl;
                            else cout<<"Yes"<<endl;
                        }
                    else{
                            if(x%2==0)
                                {
                                    if(o) cout<<"Yes"<<endl;
                                    else cout<<"No"<<endl;
                                }
                            else cout<<"Yes"<<endl;
                    }
                }
    return 0;
}


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

int main()
{
    int t;
    cin>>t;
    while(t--)
        {
            int n,x,j=0,o=0;
            cin>>n>>x;
            int a[1000];
            for(int i=0;i<n;i++)
                {
                    scanf("%d",&a[i]);
                    if(a[i]%2==0) o++;
                    else j++;
                }
            if(j%2!=0) cout<<"Yes"<<endl;
            else
                {
                    if(x==n) cout<<"No"<<endl;
                    else cout<<"Yes"<<endl;
                }

        }
    return 0;
}


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

int main()
{
    int t;
    cin>>t;
    while(t--)
        {
            int n,x,j=0,o=0;
            cin>>n>>x;
            int a[1000];
            for(int i=0;i<n;i++)
                {
                    scanf("%d",&a[i]);
                    if(a[i]%2==0) o++;
                    else j++;
                }
            if(j%2!=0)
                {
                    if(x%2==0)
                        {
                            if(j!=n) cout<<"Yes"<<endl;
                            else cout<<"No"<<endl;
                        }
                    else cout<<"Yes"<<endl;
                }
            else
                {
                    if(x==n) cout<<"No"<<endl;
                    else if(j==0) cout<<"No"<<endl;
                    else cout<<"Yes"<<endl;
                }

        }
    return 0;
}


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

int main()
{
    int t;
    cin>>t;
    while(t--)
        {
            int n,x,j=0,o=0;
            cin>>n>>x;
            int a[1000];
            for(int i=0;i<n;i++)
                {
                    scanf("%d",&a[i]);
                    if(a[i]%2==0) o++;
                    else j++;
                }
            if(j%2!=0)
                {
                    if(x%2==0)
                        {
                            if(j!=n) cout<<"Yes"<<endl;
                            else cout<<"No"<<endl;
                        }
                    else cout<<"Yes"<<endl;
                }
            else
                {
                    if(x==n) cout<<"No"<<endl;
                    else cout<<"Yes"<<endl;
                }

        }
    return 0;
}


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

int main()
{
    int t;
    cin>>t;
    while(t--)
        {
            int n,x,j=0,o=0;
            cin>>n>>x;
            int a[1000];
            for(int i=0;i<n;i++)
                {
                    scanf("%d",&a[i]);
                }
            sort(a,a+n);
            if(a[0]%2==0) o++;
            else j++;
            for(int i=1;i<n;i++)
                {
                    if(a[i]!=a[i-1])
                        {
                            if(a[i]%2==0) o++;
                            else j++;
                        }
                }
            if(o+j<x) cout<<"No"<<endl;
            else{
                    if(o+j==x)
                        {
                            if(j%2==0) cout<<"No"<<endl;
                            else cout<<"Yes"<<endl;
                        }
                    else{
                        if(j) cout<<"Yes"<<endl;
                        else cout<<"No"<<endl;
                    }
            }

        }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>

using namespace std;
typedef long long int ll;

int main()
{
    int t;
    std::cin >> t;
    while(t--)
    {
        int n, even=0, odd=0, x;
        std::cin >> n>>x;

        while(n--)
        {
            int temp;
            std::cin >> temp;
            if(temp%2==1)odd++;
            else even++;
        }

        if(odd%2==0 && odd>0)odd--;

        x -= odd;

        if(x<=0 || (x-even<=0))
        {
            std::cout << "Yes" << std::endl;
        }
        else std::cout << "No" << std::endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>

using namespace std;

int main()
{
    int t;
    std::cin >> t;
    while(t--)
    {
        int n, x;
        std::cin >> n>>x;
        int odd=0, even=0;

        for(int i=0;i<n;i++)
        {
            int temp;
            std::cin >> temp;
            if(temp%2==1)odd++;
            else even++;
        }

        if(x == n)
        {
            if(odd%2==1)
            {
                std::cout << "Yes" << std::endl;
            }
            else
            {
                std::cout << "No" << std::endl;
            }
            continue;
        }
        if(x%2==1)
        {
            if(odd==0)std::cout << "No" << std::endl;
            else std::cout << "Yes" << std::endl;
        }
        else if(x%2==0)
        {
            if(even==0 || odd==0)std::cout << "No" << std::endl;
            else std::cout << "Yes" << std::endl;
        }

    }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>

using namespace std;
typedef long long int ll;

int main()
{
    int t;
    std::cin >> t;
    while(t--)
    {
       int n, x;
       std::cin >> n>>x;
       int arr[n];
       for(int i=0;i<n;i++)
       {
           std::cin >> arr[i];
       }
       int odd=0, even=0;
       for(int i=0;i<n;i++)
       {
           if(arr[i]%2==1)odd++;
           else even++;
       }
       if(!odd)
       {
           std::cout << "No" << std::endl;
           continue;
       }

       if(odd%2==0)odd--;

       if(x<=odd)
       {
           std::cout << "Yes" << std::endl;
       }
       else
       {
           x -= odd;
           if(even >= x)std::cout << "Yes" << std::endl;
           else std::cout << "No" << std::endl;
       }
    }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>

using namespace std;
typedef long long int ll;

int main()
{
    int t;
    std::cin >> t;
    while(t--)
    {
        int n, even=0, odd=0, x;
        std::cin >> n>>x;

        while(n--)
        {
            int temp;
            std::cin >> temp;
            if(temp%2==1)odd++;
            else even++;
        }
        if((even+odd > x) || (even+odd==x && odd%2==1))
        {
            std::cout << "Yes" << std::endl;
        }
        else std::cout << "No" << std::endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>

using namespace std;
typedef long long int ll;

int main()
{
    int t;
    std::cin >> t;
    while(t--)
    {
        int n, even=0, odd=0, x;
        std::cin >> n>>x;

        while(n--)
        {
            int temp;
            std::cin >> temp;
            if(temp%2==1)odd++;
            else even++;
        }

        if(odd%2==0)odd--;

        x -= odd;

        if(x<=0 || (x-even<=0))
        {
            std::cout << "Yes" << std::endl;
        }
        else std::cout << "No" << std::endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>

using namespace std;
typedef long long int ll;

int main()
{
    int t;
    std::cin >> t;
    while(t--)
    {
        int n, even=0, odd=0, x;
        std::cin >> n>>x;

        while(n--)
        {
            int temp;
            std::cin >> temp;
            if(temp%2==1)odd++;
            else even++;
        }
        if((even+odd > x && odd>=1) || (even+odd==x && odd%2==1))
        {
            std::cout << "Yes" << std::endl;
        }
        else std::cout << "No" << std::endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>

using namespace std;
typedef long long int ll;

int main()
{
    int t;
    std::cin >> t;
    while(t--)
    {
        int n, even=0, odd=0, x;
        std::cin >> n>>x;

        while(n--)
        {
            int temp;
            std::cin >> temp;
            if(temp%2==1)odd++;
            else even++;
        }

        if(!odd)
        {
            std::cout << "No" << std::endl;
            continue;
        }

        if(odd%2==0)odd--;

        x -= odd;

        if(x<=0 || (x-even<=0))
        {
            std::cout << "Yes" << std::endl;
        }
        else std::cout << "No" << std::endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>

using namespace std;

int main()
{
    int t;
    std::cin >> t;
    while(t--)
    {
        int n, x;
        std::cin >> n>>x;
        int odd=0, even=0;

        for(int i=0;i<n;i++)
        {
            int temp;
            std::cin >> temp;
            if(temp%2==1)odd++;
            else even++;
        }

        if(x == n)
        {
            if(odd%2==1)
            {
                std::cout << "Yes" << std::endl;
            }
            else
            {
                std::cout << "No" << std::endl;
            }
            continue;
        }
        if(odd == n || odd==0)std::cout << "No" << std::endl;
        else std::cout << "Yes" << std::endl;

    }
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int countodd(int arr[],int n) {
int counti=0;
for (int i=0;i<n;i++) {
    if (arr[i]%2!=0) {
        counti++;
    }
}
return counti;
}

int counteven(int arr[],int n) {
int count=0;

for (int i=0;i<n;i++) {
    if(arr[i]%2==0) {
        count++;
    }
}
return count;
}

int main() {
	//code

	int t;
	cin >>t;
	while (t--) {
       int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }
int flag=0;
        int k =min(countodd(arr,n),x);
       for (int i =1;i<=k;i=i+2) {
        if (counteven(arr,n)>=(x-i)) {
            flag=1;
            break;
        }

       }
       if (flag==1) {
        cout <<"Yes"<<endl;
       }
       else {
        cout << "No"<<endl;
       }

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int countodd(int arr[],int n) {
int count=0;
for (int i=0;i<n;i++) {
    if (arr[i]%2!=0) {
        count++;
    }
}
return count;
}

int counteven(int arr[],int n) {
int count=0;

for (int i=0;i<n;i++) {
    if(arr[i]%2==0) {
        count++;
    }
}
return count;
}

int sumodd(int arr[],int n,int x) {

if (x>n) {
    return 0;
}
else if (n==x){
    int sum;
    for (int i=0;i<n;i++) {
    sum=sum+arr[i];

    }
    if (sum%2==0) {
        return 0;
    }
    else {
        return 1;
    }
}
else if (x<n) {

   int o = countodd(arr,n);
   int e = counteven(arr,n);

   if (o%2!=0 && e>0) {
    return 1;

   }
   else {
    return 0;
   }

}
}

int main() {
	//code

	int t;
	cin >>t;
	while (t--) {
       int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }

        if (sumodd(arr,n,x)) {
            cout <<"Yes"<<endl;
        }
        else {
            cout << "No"<<endl;
        }

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

bool searchodd(int arr[],int n) {
for (int i=0;i<n;i++) {
if (arr[i]%2!=0) {
    return 1;

}

}
return 0;
}

int searcheven(int arr[],int n) {
    int count=0;
for (int i=0;i<n;i++) {

        if (arr[i]%2==0) {
            count++;
        }
}
return count;
}

int sumodd(int arr[],int n,int x) {

if (x>n) {
    return 0;
}
else if (n==x){
    int sum;
    for (int i=0;i<n;i++) {
    sum=sum+arr[i];

    }
    if (sum%2==0) {
        return 0;
    }
    else {
        return 1;
    }
}
else if (x<n) {
        int p = searcheven(arr,n);
    if (searchodd(arr,n) && p>=x-1) {

            return 1;
    }
        else {
            return 0;
        }

}
}

int main() {
	//code
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	cin >>t;
	while (t--) {
       int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }

        if (sumodd(arr,n,x)) {
            cout << "Yes";
        }
        else {
            cout << "No";
        }
        cout <<endl;

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int countodd(int arr[],int n) {
int count=0;
for (int i=0;i<n;i++) {
    if (arr[i]%2!=0) {
        count++;
    }
}
return count;
}

int counteven(int arr[],int n) {
int count=0;

for (int i=0;i<n;i++) {
    if(arr[i]%2==0) {
        count++;
    }
}
return count;
}

bool sumodd(int arr[],int n,int x) {

if (x>n) {
    return 0;
}
else if (n==x){
    int sum;
    for (int i=0;i<n;i++) {
    sum=sum+arr[i];

    }
    if (sum%2==0) {
        return 0;
    }
    else {
        return 1;
    }
}
else if (x<n) {

   int o = countodd(arr,n);
   int e = counteven(arr,n);

   if (e==0 && o%2==0) {
    return 0;
   }
   else if (e==0 && o%2!=0) {
    return 1;
   }
   else if(o==0) {
    return 0;
   }
   else if (o%2!=0) {
    return 1;
   }
   else {
    return 0;
   }

}
}

int main() {
	//code

	int t;
	cin >>t;
	while (t--) {
       int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }

        if (sumodd(arr,n,x)) {
            cout <<"Yes"<<endl;
        }
        else {
            cout << "No"<<endl;
        }

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

bool searchodd(int arr[],int n) {
for (int i=0;i<n;i++) {
if (arr[i]%2!=0) {
    return 1;

}

}
return 0;
}

int searcheven(int arr[],int n) {
    int count=0;
for (int i=0;i<n;i++) {

        if (arr[i]%2==0) {
            count++;
        }
}
return count;
}

int sumodd(int arr[],int n,int x) {

if (x>n) {
    return 0;
}
else if (n==x){
    int sum;
    for (int i=0;i<n;i++) {
    sum=sum+arr[i];

    }
    if (sum%2==0) {
        return 0;
    }
    else {
        return 1;
    }
}
else if (x<n) {
        int p = searcheven(arr,n);
    if (searchodd(arr,n)) {
        if (p>=x-1) {
            return 1;
        }
        else {
            return 0;
        }
    }
    else {
        return 0;
    }

}
}

int main() {
	//code
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	cin >>t;
	while (t--) {
        int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }

        if (sumodd(arr,n,x)) {
            cout << "Yes";
        }
        else {
            cout << "No";
        }
        cout <<endl;

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int countodd(int arr[],int n) {
int count=0;
for (int i=0;i<n;i++) {
    if (arr[i]%2!=0) {
        count++;
    }
}
return count;
}

int counteven(int arr[],int n) {
int count=0;

for (int i=0;i<n;i++) {
    if(arr[i]%2==0) {
        count++;
    }
}
return count;
}

int sumodd(int arr[],int n,int x) {

if (x>n) {
    return 0;
}
else if (n==x){
    int sum;
    for (int i=0;i<n;i++) {
    sum=sum+arr[i];

    }
    if (sum%2==0) {
        return 0;
    }
    else {
        return 1;
    }
}
else if (x<n) {

   int o = countodd(arr,n);
   int e = counteven(arr,n);

   if (o%2!=0) {
    return 1;

   }
   else {
    return 0;
   }

}
}

int main() {
	//code

	int t;
	cin >>t;
	while (t--) {
       int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }

        if (sumodd(arr,n,x)) {
            cout <<"Yes"<<endl;
        }
        else {
            cout << "No"<<endl;
        }

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int countodd(int arr[],int n) {
int counti=0;
for (int i=0;i<n;i++) {
    if (arr[i]%2!=0) {
        counti++;
    }
}
return counti;
}

int counteven(int arr[],int n) {
int count=0;

for (int i=0;i<n;i++) {
    if(arr[i]%2==0) {
        count++;
    }
}
return count;
}

int main() {
	//code

	int t;
	cin >>t;
	while (t--) {
       int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }
int flag=0;
        int k =min(countodd(arr,n),x);
       for (int i =1;i<=k;i=i+2) {
        if (counteven(arr,n)>=(x-i)) {
            flag=1;
        }

       }
       if (flag==1) {
        cout <<"Yes"<<endl;
       }
       else {
        cout << "No"<<endl;
       }

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

bool searchodd(int arr[],int n) {
for (int i=0;i<n;i++) {
if (arr[i]%2!=0) {
    return 1;

}

}
return 0;
}

int searcheven(int arr[],int n) {
    int count=0;
for (int i=0;i<n;i++) {

        if (arr[i]%2==0) {
            count++;
        }
}
return count;
}

int sumodd(int arr[],int n,int x) {

if (x>n) {
    return 0;
}
else if (n==x){
    int sum;
    for (int i=0;i<n;i++) {
    sum=sum+arr[i];

    }
    if (sum%2==0) {
        return 0;
    }
    else {
        return 1;
    }
}
else if (x<n) {
        int p = searcheven(arr,n);
    if (searchodd(arr,n) && p>=x-1) {
        return 1;
    }
    else {
        return 0;
    }

}
}

int main() {
	//code
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	cin >>t;
	while (t--) {
        int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }

        if (sumodd(arr,n,x)) {
            cout << "Yes";
        }
        else {
            cout << "No";
        }
        cout <<endl;

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

bool searchodd(int arr[],int n) {
for (int i=0;i<n;i++) {
if (arr[i]%2!=0) {
    return 1;
    break;
}

}
return 0;
}

int searcheven(int arr[],int n) {
    int count=0;
for (int i=0;i<n;i++) {

        if (arr[i]%2==0) {
            count++;
        }
}
return count;
}

int sumodd(int arr[],int n,int x) {

if (x>n) {
    return 0;
}
else if (n==x){
    int sum;
    for (int i=0;i<n;i++) {
    sum=sum+arr[i];

    }
    if (sum%2==0) {
        return 0;
    }
    else {
        return 1;
    }
}
else {
        int p = searcheven(arr,n);
    if (searchodd(arr,n) && p>=x-1) {
        return 1;
    }
    else {
        return 0;
    }

}
}

int main() {
	//code
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	cin >>t;
	while (t--) {
        int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }

        if (sumodd(arr,n,x)) {
            cout << "Yes";
        }
        else {
            cout << "No";
        }
        cout <<endl;

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int countodd(int arr[],int n) {
int count=0;
for (int i=0;i<n;i++) {
    if (arr[i]%2!=0) {
        count++;
    }
}
return count;
}

int counteven(int arr[],int n) {
int count=0;

for (int i=0;i<n;i++) {
    if(arr[i]%2==0) {
        count++;
    }
}
return count;
}

bool sumodd(int arr[],int n,int x) {

if (x>n) {
    return 0;
}
else if (n==x){
    int sum;
    for (int i=0;i<n;i++) {
    sum=sum+arr[i];

    }
    if (sum%2==0) {
        return 0;
    }
    else {
        return 1;
    }
}
else if (x<n) {

   int o = countodd(arr,n);
   int e = counteven(arr,n);

   if (o%2!=0) {
    return 1;

   }
   else {
    return 0;
   }

}
}

int main() {
	//code

	int t;
	cin >>t;
	while (t--) {
       int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }

        if (sumodd(arr,n,x)) {
            cout <<"Yes"<<endl;
        }
        else {
            cout << "No"<<endl;
        }

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int sumodd(int arr[],int n,int x) {

if (x>n) {
    return 0;
}
else if (n==x){
    int sum=0;
    for (int i=0;i<n;i++) {
    sum=sum+arr[i];

    }
    if (sum%2==0) {
        return 0;
    }
    else {
        return 1;
    }
}
else {

    for (int i=0;i<n-x;i++) {
            int sum;
        for (int j=i;j<=i+x;j++) {
            sum = sum+arr[j];
        }
        if (sum%2!=0) {
            return 1;
        }
    }

    return 0;

}
}

int main() {
	//code
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	cin >>t;
	while (t--) {
        int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }

        if (sumodd(arr,n,x)) {
            cout << "Yes";
        }
        else {
            cout << "No";
        }
        cout <<endl;

	}
	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int countodd(int arr[],int n) {
int count=0;
for (int i=0;i<n;i++) {
    if (arr[i]%2!=0) {
        count++;
    }
}
return count;
}

int counteven(int arr[],int n) {
int count=0;

for (int i=0;i<n;i++) {
    if(arr[i]%2==0) {
        count++;
    }
}
return count;
}

bool sumodd(int arr[],int n,int x) {

if (x>n) {
    return 0;
}
else if (n==x){
    int sum;
    for (int i=0;i<n;i++) {
    sum=sum+arr[i];

    }
    if (sum%2==0) {
        return 0;
    }
    else {
        return 1;
    }
}
else if (x<n) {

   int o = countodd(arr,n);
   int e = counteven(arr,n);

   if (o>0) {
    return 1;
   }
   else {
    return 0;
   }

}
}

int main() {
	//code

	int t;
	cin >>t;
	while (t--) {
       int n,x;
        cin >>n>>x;

        int arr[n];
        for (int i=0;i<n;i++) {
            cin >>arr[i];
        }

        if (sumodd(arr,n,x)) {
            cout <<"Yes"<<endl;
        }
        else {
            cout << "No"<<endl;
        }

	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
int main() {
    int t,n,x,a;
    scanf("%d",&t);
    while(t--)
    {
       scanf("%d%d",&n,&x);
       int oddCnt=0;
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a);
           if(a&1)
            oddCnt++;
           else if(x>1)
            x--;
       }
       while(x>1)
       {
           if(oddCnt>=3&&x>=3)
            {
             oddCnt-=2;
              x-=2;
           }else
             break;
       }
       if(oddCnt>=1&&x==1)
         printf("Yes\n");
       else
         printf("No\n");
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
int main() {
    int t,n,x,a;
    scanf("%d",&t);
    while(t--)
    {
       scanf("%d%d",&n,&x);
       int oddCnt=0;
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a);
           if(a&1)
            oddCnt++;
       }
       int evenCnt=n-oddCnt;
       while(x>1)
       {
           if(oddCnt>=3&&x>=3)
            {
             oddCnt-=2;
              x-=2;
           }else
             break;
       }
       if(oddCnt>=1&&x-1<=evenCnt)
         printf("Yes\n");
       else
         printf("No\n");
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
int main() {
    int t,n,x,a;
    scanf("%d",&t);
    while(t--)
    {
       scanf("%d%d",&n,&x);
       int oddCnt=0;
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a);
           if(a&1)
            oddCnt++;
           else if(x>1)
            x--;
       }
       x-=min(x-1,((int)(oddCnt-1)/2)*2);
       if(oddCnt>=1&&x==1)
         printf("Yes\n");
       else
         printf("No\n");
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
int main() {
    int t,n,x,a;
    scanf("%d",&t);
    while(t--)
    {
       scanf("%d%d",&n,&x);
       int oddCnt=0;
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a);
           if(a&1)
            oddCnt++;
           else if(x>1)
            x--;
       }
       while(x>1)
       {
           if(oddCnt>=3)
            {
             oddCnt-=2;
              x-=2;
           }else
             break;
       }
       if(oddCnt>=1&&x==1)
         printf("Yes\n");
       else
         printf("No\n");
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
int main() {
    int t,n,x,a;
    scanf("%d",&t);
    while(t--)
    {
       scanf("%d%d",&n,&x);
       int oddCnt=0;
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a);
           if(a&1)
            oddCnt++;
       }
       while(x>1)
       {
           if(oddCnt>=3&&x>=3)
            {
             oddCnt-=2;
              x-=2;
           }else
             break;
       }
       if(oddCnt>=1&&x-1<=n-oddCnt)
         printf("Yes\n");
       else
         printf("No\n");
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
int main() {
    int t,n,x,a;
    scanf("%d",&t);
    while(t--)
    {
       scanf("%d%d",&n,&x);
       int oddCnt=0;
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a);
           if(a&1)
            oddCnt++;
       }
       x-=min(x-1,(oddCnt-1)/2);
       if(oddCnt&&x-1<=n-oddCnt)
         printf("Yes\n");
       else
         printf("No\n");
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
int main() {
    int t,n,x,a;
    scanf("%d",&t);
    while(t--)
    {
       scanf("%d%d",&n,&x);
       int oddCnt=0;
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a);
           if(a&1)
            oddCnt++;
           else if(x>1)
            x--;
       }
       x-=min(x-1,(oddCnt-1)/2);
       if(oddCnt>=1&&x==1)
         printf("Yes\n");
       else
         printf("No\n");
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
ll gcd (ll x,ll y){if(y==0)return x;return gcd(y,x%y);}
ll lcm(ll a,ll b){return a/gcd(a,b) * b;}
int main() {
    int t,n,x,a;
    scanf("%d",&t);
    while(t--)
    {
       scanf("%d%d",&n,&x);
       int oddCnt=0;
       for(int i=0;i<n;i++)
       {
           scanf("%d",&a);
           if(a&1)
            oddCnt++;
       }
       while(x>1)
       {
           if(oddCnt>=3&&x>=3)
            {
             oddCnt-=2;
              x-=2;
           }else
             break;
       }
       if(oddCnt>=1&&x-1<=n-oddCnt&&(x-1)&1==0)
         printf("Yes\n");
       else
         printf("No\n");
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,i,j,c=0,d=0,a,b;
    cin>>t;
    while(t--)
    {
      cin>>n>>b;
      for(i=0; i<n; i++)
      {
          cin>>a;
          if(a%2!=0)
          {
              d++;
          }
          else
          {
              c++;
          }
      }
      if(d==0)
      {
          cout<<"No"<<endl;
      }
      if(d%2!=0)
      {
          if(c+d>=b)
          {
              cout<<"Yes"<<endl;
          }
          else{
             cout<<"No"<<endl;
          }
      }
      else if((d-1)+c>=b)
      {
          cout<<"Yes"<<endl;
      }
      else
      {
        cout<<"No"<<endl;
      }
      c=0;
      d=0;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,i,j,c=0,d=0,a,b;
    cin>>t;
    while(t--)
    {
      cin>>n>>b;
      for(i=0; i<n; i++)
      {
          cin>>a;
          if(a%2!=0)
          {
              d++;
          }
          else
          {
              c++;
          }
      }
      if(d==0)
      {
          cout<<"No"<<endl;
      }
      else if(d%2!=0)
      {
          if(c+d>=b)
          {
              cout<<"Yes"<<endl;
          }
          else{
             cout<<"No"<<endl;
          }
      }
      else if((d-1)+c>=b)
      {
          cout<<"Yes"<<endl;
      }
      else
      {
        cout<<"No"<<endl;
      }
      c=0;
      d=0;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,x,c=0,d=0,i,j,k=0;
    cin>>t;
    while(t--)
    {
        set<int>s;
        cin>>n>>x;
        int a[n];
        for(i=0; i<n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
            {
                c++;
            }
            else
            {
                d++;
            }
            k+=a[i];
            s.insert(a[i]);
        }
        if(x==n)
        {
            if(k%2!=0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
               cout<<"No"<<endl;
            }
        }
        else if(x==1)
        {
            if(d>0){
            cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
        }
        else if(x==2)
        {
            if(c>0 && d>0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }

        }
        else if(x>2)
        {
            if((abs(x-1))==c && d>0 || (abs(x-1))==d && c>0)
            {
                cout<<"Yes"<<endl;
            }
            else if(d>c)
            {
                 cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
        }
        c=0;
        d=0;
        k=0;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,i,j,c=0,d=0,a,b;
    cin>>t;
    while(t--)
    {
      cin>>n>>b;
      for(i=0; i<n; i++)
      {
          cin>>a;
          if(a%2!=0)
          {
              d++;
          }
          else
          {
              c++;
          }
      }
      if(d==0)
      {
          cout<<"No"<<endl;
      }
      else if(1+c>=b)
      {
          cout<<"Yes"<<endl;
      }
      else
      {
        cout<<"No"<<endl;
      }
      c=0;
      d=0;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,x,c=0,d=0,i,j,k=0;
    cin>>t;
    while(t--)
    {
        vector<int>v;
        vector<int>v1;
        set<int>s;
        cin>>n>>x;
        int a[n];
        for(i=0; i<n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
            {
                c++;
                v.push_back(a[i]);
            }
            else
            {
                d++;
                v1.push_back(a[i]);
            }
            k+=a[i];
            s.insert(a[i]);
        }
        if(x==n)
        {
            if(k%2!=0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
               cout<<"No"<<endl;
            }
        }
        else if(x==1)
        {
            if(d>0){
            cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
        }
        else if(x==2)
        {
            if(c>0 && d>0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }

        }
       else
       {
           if(s.size()==n)
           {
               if(c%2!=0 || d%2!=0)
               {
                   cout<<"Yes"<<endl;
               }
               else
               {
                  cout<<"No"<<endl;
               }
           }
           else
           {
               if(c>=x && d>0 || d>=x && c>0)
               {
                   cout<<"Yes"<<endl;
               }
               else
               {
                   cout<<"No"<<endl;
               }
           }
       }
        c=0;
        d=0;
        k=0;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,x,c=0,d=0,i,j,k=0;
    cin>>t;
    while(t--)
    {
        vector<int>v;
        vector<int>v1;
        set<int>s;
        cin>>n>>x;
        int a[n];
        for(i=0; i<n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
            {
                c++;
                v.push_back(a[i]);
            }
            else
            {
                d++;
                v1.push_back(a[i]);
            }
            k+=a[i];
            s.insert(a[i]);
        }
        if(x==n)
        {
            if(k%2!=0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
               cout<<"No"<<endl;
            }
        }
        else if(x==1)
        {
            if(d>0){
            cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
        }
        else if(x==2)
        {
            if(c>0 && d>0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }

        }
       else
       {
           if(s.size()==n)
           {
               if(c%2!=0 || d%2!=0)
               {
                   cout<<"Yes"<<endl;
               }
               else
               {
                  cout<<"No"<<endl;
               }
           }
           else
           {
               if(c>=(x-1) && d>0 || d>=(x-1) && c>0)
               {
                   cout<<"Yes"<<endl;
               }
               else
               {
                   cout<<"No"<<endl;
               }
           }
       }
        c=0;
        d=0;
        k=0;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,x,c=0,d=0,i,j,k=0,m=0,p=0,y=0;
    cin>>t;
    while(t--)
    {
        vector<int>v;
        vector<int>v1;
        set<int>s;
        cin>>n>>x;
        int a[n];
        for(i=0; i<n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
            {
                c++;

            }
            else
            {
                m+=a[i];

                d++;
            }
             v.push_back(a[i]);
            k+=a[i];
        }
        if(x==n)
        {
            if(k%2!=0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
               cout<<"No"<<endl;
            }
        }
        else if(x==1)
        {
            if(d>0){
            cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
        }
        else if(x==2)
        {
            if(c>0 && d>0 || m%2!=0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }

        }
       else
       {
          for(i=0;i<x; i++)
          {
              y+=v[i];
          }
          if(y%2!=0)
          {
              cout<<"Yes"<<endl;
          }
          else
          {
              for(i=x; i<n; i++)
              {
                 if(v[i]%2!=0)
                 {
                     p++;
                 }
              }
              if(p>0)
              {
                  cout<<"Yes"<<endl;
              }
              else
              {
                 cout<<"No"<<endl;
              }
          }
       }
        c=0;
        d=0;
        k=0;
        y=0;
        p=0;
        m=0;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,n,i,j,c=0,d=0,a,b;
    cin>>t;
    while(t--)
    {
      cin>>n>>b;
      for(i=0; i<n; i++)
      {
          cin>>a;
          if(a%2!=0)
          {
              d++;
          }
          else
          {
              c++;
          }
      }

      if(d==0)
      {
          cout<<"No"<<endl;
      }
     else if(b%2==0)
      {
          if(c==0)
          {
               cout<<"No"<<endl;
          }
          else
          {
              if(d%2!=0)
              {
                  if(d+c>=b)
                  { cout<<"Yes"<<endl;
                  }
                  else{
                      cout<<"No"<<endl;
                  }
              }
              else
              {
                if((d-1)+c>=b)
                  {
                       cout<<"Yes"<<endl;
                  }
                  else{
                     cout<<"No"<<endl;
                  }
              }
          }
      }
      else if(d%2!=0)
      {
          if(c+d>=b)
          {
              cout<<"Yes"<<endl;
          }
          else{
             cout<<"No"<<endl;
          }
      }
      else if((d-1)+c>=b)
      {
          cout<<"Yes"<<endl;
      }
      else
      {
        cout<<"No"<<endl;
      }
      c=0;
      d=0;
    }

    return 0;
}


//g++  7.4.0

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,x,y=0,z=0,d=0;
        cin>>n>>x;
        int a[n];
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
            {
                y++;
            }
            else
            {
                z++;
            }
        }
          if(x%2==0)
          {
              x--;
              d=y-x;
              if(d>=0&& z>0)
              {
                  cout<<"YES"<<endl;
              }
              else if(d%2==-1 || d%2==1)
              {
                  cout<<"YES"<<endl;
              }
              else
              {
                  cout<<"NO"<<endl;
              }
          }
        else
        {
             d=y-x;
              if(d>=0 && z>0)
              {
                  cout<<"YES"<<endl;
              }
              else if(d%2==-1 || d%2==1)
              {
                  cout<<"YES"<<endl;
              }
              else
              {
                  cout<<"NO"<<endl;
              }
        }
    }
}


//g++  7.4.0

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,x,y=0,z=0,d=0,o=0,e=0;
        cin>>n>>x;
        int a[n];
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
            {
                e++;
            }
            else
            {
                o++;
            }
        }
        if(x%2==0)
        {
           if(o<x-1)
           {
               if(o==0)
               {
                    cout<<"NO"<<endl;
               }
               else if(x-e==n/2)
               {
                   cout<<"NO"<<endl;
               }
               else
               {
                   cout<<"YES"<<endl;
               }
           }
             else
            {
                if(e>0)
                    cout<<"Yes\n";
                else
                    cout<<"No\n";
            }
        }
        else
        {
           if(o<x)
           {
               if(o==0)
               {
                    cout<<"NO"<<endl;
               }
               else if(x==n && o%2==0)
               {
                   cout<<"NO"<<endl;
               }
               else
               {
                   cout<<"YES"<<endl;
               }
           }
            else
            {
                cout<<"YES"<<endl;
            }

        }
    }
}


//g++  7.4.0

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,x,y=0,z=0,d=0;
        cin>>n>>x;
        int a[n];
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
            {
                y++;
            }
            else
            {
                z++;
            }
        }
          if(x%2==0)
          {

              if(z>0)
              {
                  cout<<"YES"<<endl;
              }
              else
              {
                  cout<<"NO"<<endl;
              }
          }
        else
        {
            if(z>0 && z%2==1)
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
        }
    }
}


//g++  7.4.0

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,x,y=0,z=0,d=0;
        cin>>n>>x;
        int a[n];
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            if(a[i]%2==0)
            {
                y++;
            }
            else
            {
                z++;
            }
        }
          if(x%2==0)
          {

              if(z>0 && y>0)
              {
                  cout<<"YES"<<endl;
              }
              else
              {
                  cout<<"NO"<<endl;
              }
          }
        else
        {
            if(z>0 && z%2==1)
            {
                cout<<"YES"<<endl;
            }
            else
            {
                cout<<"NO"<<endl;
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int x=0,y=0,z=0;
        string s;
        cin>>s;
        if(s.length()>3)
        {
            for(int i=1;i<s.length();i++)
            {
                if(s[i]=='0')
                {
                    y++;
                }
                else
                {
                    z++;
                }
            }
            if(y>z)
            {
                cout<<z<<endl;
            }
            else
            {
                cout<<y<<endl;
            }
    }
        else if(s.length()==3)
        {
           if(s[0]=='0'&& s[1]=='1'&& s[2]=='0')
           {
               cout<<1<<endl;
           }
            else if(s[0]=='1'&&s[1]=='0'&& s[2]=='1')
           {
               cout<<1<<endl;
           }
            else
            {
                cout<<0<<endl;
            }
        }
        else
        {
            cout<<0<<endl;
        }
}
}


#include <bits/stdc++.h>

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define pll pair <ll, ll>
#define f first
#define s second
#define ins insert
#define ers erase
#define rtn return
#define sz size
#define fop freopen

using namespace std;

const int maxn = (int)(2e3 + 11);
const int inf = (int)(1e9 + 7);
const int base = (int)(1e9 + 7);
const int mod = (int)(1e9 + 7);
const double eps = (double)(1e-9);

int n, m, k, x, y, x2, y2, used[maxn][maxn];
short pnt[maxn][maxn][4];
char c[maxn][maxn];
pii D[4][maxn];

inline bool check(short x, short y){
	return x >= 0 && x < n && y >= 0 && y < m && c[x][y] != '#';
}

int main(){
	//freopen("in", "r", stdin);
  	//freopen("out", "w", stdout);
    scanf("%d%d%d\n", &n, &m, &k);
    for(short i = 0; i < n; ++i){
    	for(short j = 0; j < m; ++j){
    		scanf("%c", &c[i][j]);
    	}
    	scanf("\n");
    }
    scanf("%d%d%d%d", &x, &y, &x2, &y2);
    for(short i = 1; i <= k; ++i){
    	D[0][i - 1] = mp(-i, 0);
    	D[1][i - 1] = mp(i, 0);
    	D[2][i - 1] = mp(0, -i);
    	D[3][i - 1] = mp(0, i);
    }
    x--, y--, x2--, y2--;
    if(c[x2][y2] == '#' || c[x][y] == '#'){
        printf("-1");
        return 0;
    }
    queue <pii> q;
    q.push(mp(x2, y2));
    used[x2][y2] = 1;
    while(!q.empty() && !used[x][y]){
    	short x0 = q.front().f, y0 = q.front().s;
    	q.pop();
    	for(short i = 0; i < 4; ++i){
    		short st;
    		if(i == 0){
    			if(used[x0 - 1][y0]){
    				st = pnt[x0 - 1][y0][0] - 1;
    			} else st = k - 1;
    		}
    		if(i == 1){
    			if(used[x0 + 1][y0]){
    				st = pnt[x0 + 1][y0][1] - 1;
    			} else st = k - 1;
    		}
    		if(i == 2){
    			if(used[x0][y0 - 1]){
    				st = pnt[x0][y0 - 1][2] - 1;
    			} else st = k - 1;
    		}
    		if(i == 3){
    			if(used[x0][y0 + 1]){
    				st = pnt[x0][y0 + 1][3] - 1;
    			} else st = k - 1;
    		}
    		for(short &j = pnt[x0][y0][i]; j < k; ++j){
    			short xn = D[i][j].f + x0, yn = D[i][j].s + y0;
    			if(!check(xn, yn)) break;
    			if(used[xn][yn]) continue;
    			used[xn][yn] = used[x0][y0] + 1;
    			q.push(mp(xn, yn));
    		}
    	}
    }
    printf("%d", used[x][y] - 1);
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define pll pair <ll, ll>
#define f first
#define s second
#define ins insert
#define ers erase
#define rtn return
#define sz size
#define fop freopen

using namespace std;

const int maxn = (int)(2e3 + 11);
const int inf = (int)(1e9 + 7);
const int base = (int)(1e9 + 7);
const int mod = (int)(1e9 + 7);
const double eps = (double)(1e-9);

int n, m, k, x, y, x2, y2, used[maxn][maxn];
short pnt[maxn][maxn][4];
char c[maxn][maxn];
pii D[4][maxn];

inline bool check(short x, short y){
	return x >= 0 && x < n && y >= 0 && y < m && c[x][y] != '#';
}

int main(){
	//freopen("in", "r", stdin);
  	//freopen("out", "w", stdout);
    scanf("%d%d%d\n", &n, &m, &k);
    for(short i = 0; i < n; ++i){
    	for(short j = 0; j < m; ++j){
    		scanf("%c", &c[i][j]);
    	}
    	scanf("\n");
    }
    scanf("%d%d%d%d", &x, &y, &x2, &y2);
    for(short i = 1; i <= k; ++i){
    	D[0][i - 1] = mp(-i, 0);
    	D[1][i - 1] = mp(i, 0);
    	D[2][i - 1] = mp(0, -i);
    	D[3][i - 1] = mp(0, i);
    }
    x--, y--, x2--, y2--;
    if(c[x2][y2] == '#' || c[x][y] == '#'){
        printf("-1");
        return 0;
    }
    queue <pii> q;
    q.push(mp(x2, y2));
    used[x2][y2] = 1;
    while(!q.empty() && !used[x][y]){
    	short x0 = q.front().f, y0 = q.front().s;
    	q.pop();
    	for(short i = 0; i < 4; ++i){
    		short st = 0;
    		if(i == 0){
    			if(used[x0 - 1][y0] && pnt[x0 - 1][y0][0]){
    				if(pnt[x0 - 1][y0][0] != k){
    					st = pnt[x0 - 1][y0][0];
    				} else st = k - 1;
    			}
    			if(used[x0 + 1][y0] <= used[x0][y0]){
    				st = k;
    			}
    		}
    		if(i == 1){
    			if(used[x0 + 1][y0] && pnt[x0 + 1][y0][1]){
    				if(pnt[x0 + 1][y0][1] != k){
    					st = pnt[x0 + 1][y0][1];
    				} else st = k - 1;
    			}
    			if(used[x0 - 1][y0] <= used[x0][y0]){
    				st = k;
    			}
    		}
    		if(i == 2){
    			if(used[x0][y0 - 1] && pnt[x0][y0 - 1][2]){
    				if(pnt[x0][y0 - 1][2] != k){
    					st = pnt[x0][y0 - 1][2];
    				} else st = k - 1;
    			}
    			if(used[x0][y0 + 1] <= used[x0][y0]){
    				st = k;
    			}
    		}
    		if(i == 3){
    			if(used[x0][y0 + 1] && pnt[x0][y0 + 1][3]){
    				if(pnt[x0][y0 + 1][3] != k){
    					st = pnt[x0][y0 + 1][3];
    				} else st = k - 1;
    			}
    			if(used[x0][y0 - 1] <= used[x0][y0]){
    				st = k;
    			}
    		}
    		pnt[x0][y0][i] = st;
    		for(short &j = pnt[x0][y0][i]; j < k; ++j){
    			short xn = D[i][j].f + x0, yn = D[i][j].s + y0;
    			if(!check(xn, yn)) break;
    			if(used[xn][yn]) continue;
    			used[xn][yn] = used[x0][y0] + 1;
    			q.push(mp(xn, yn));
    		}
    	}
    }
    printf("%d", used[x][y] - 1);
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define pll pair <ll, ll>
#define f first
#define s second
#define ins insert
#define ers erase
#define rtn return
#define sz size
#define fop freopen

using namespace std;

const int maxn = (int)(2e3 + 11);
const int inf = (int)(1e9 + 7);
const int base = (int)(1e9 + 7);
const int mod = (int)(1e9 + 7);
const double eps = (double)(1e-9);

int n, m, k, x, y, x2, y2, used[maxn][maxn];
short pnt[maxn][maxn][4];
char c[maxn][maxn];
pii D[4][maxn];

inline bool check(short x, short y){
	return x >= 0 && x < n && y >= 0 && y < m && c[x][y] != '#';
}

int main(){
	//freopen("in", "r", stdin);
  	//freopen("out", "w", stdout);
    scanf("%d%d%d\n", &n, &m, &k);
    for(short i = 0; i < n; ++i){
    	for(short j = 0; j < m; ++j){
    		scanf("%c", &c[i][j]);
    	}
    	scanf("\n");
    }
    scanf("%d%d%d%d", &x, &y, &x2, &y2);
    for(short i = 1; i <= k; ++i){
    	D[0][i - 1] = mp(-i, 0);
    	D[1][i - 1] = mp(i, 0);
    	D[2][i - 1] = mp(0, -i);
    	D[3][i - 1] = mp(0, i);
    }
    x--, y--, x2--, y2--;
    if(c[x2][y2] == '#' || c[x][y] == '#'){
        printf("-1");
        return 0;
    }
    queue <pii> q;
    q.push(mp(x2, y2));
    used[x2][y2] = 1;
    while(!q.empty() && !used[x][y]){
    	short x0 = q.front().f, y0 = q.front().s;
    	q.pop();
    	for(short i = 0; i < 4; ++i){
    		short st;
    		if(i == 0){
    			if(used[x0 - 1][y0]){
    				st = pnt[x0 - 1][y0][0] - 1;
    			} else st = 0;
    		}
    		if(i == 1){
    			if(used[x0 + 1][y0]){
    				st = pnt[x0 + 1][y0][1] - 1;
    			} else st = 0;
    		}
    		if(i == 2){
    			if(used[x0][y0 - 1]){
    				st = pnt[x0][y0 - 1][2] - 1;
    			} else st = 0;
    		}
    		if(i == 3){
    			if(used[x0][y0 + 1]){
    				st = pnt[x0][y0 + 1][3] - 1;
    			} else st = 0;
    		}
    		pnt[x0][y0][i] = st;
    		for(short &j = pnt[x0][y0][i]; j < k; ++j){
    			short xn = D[i][j].f + x0, yn = D[i][j].s + y0;
    			if(!check(xn, yn)) break;
    			if(used[xn][yn]) continue;
    			used[xn][yn] = used[x0][y0] + 1;
    			q.push(mp(xn, yn));
    		}
    	}
    }
    printf("%d", used[x][y] - 1);
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define pll pair <ll, ll>
#define f first
#define s second
#define ins insert
#define ers erase
#define rtn return
#define sz size
#define fop freopen

using namespace std;

const int maxn = (int)(2e3 + 11);
const int inf = (int)(1e9 + 7);
const int base = (int)(1e9 + 7);
const int mod = (int)(1e9 + 7);
const double eps = (double)(1e-9);

int n, m, k, x, y, x2, y2, used[maxn][maxn];
char c[maxn][maxn];
vector <pii> D[4];

bool check(int x, int y){
	return x >= 0 && x < n && y >= 0 && y < m && c[x][y] != '#';
}

int main(){
	//freopen("in", "r", stdin);
  	//freopen("out", "w", stdout);
    ios_base :: sync_with_stdio(false);
    cin >> n >> m >> k;
    for(int i = 0; i < n; ++i){
    	for(int j = 0; j < m; ++j){
    		cin >> c[i][j];
    	}
    }
    cin >> x >> y >> x2 >> y2;
    for(int i = 1; i <= k; ++i){
    	D[0].pb(mp(-i, 0));
    	D[1].pb(mp(i, 0));
    	D[2].pb(mp(0, -i));
    	D[3].pb(mp(0, i));
    }
    x--, y--, x2--, y2--;
    if(c[x2][y2] == '#' || c[x][y] == '#'){
        cout << -1;
        return 0;
    }
    queue <pii> q;
    q.push(mp(x2, y2));
    used[x2][y2] = 1;
    while(!q.empty() && !used[x][y]){
    	int x0 = q.front().f, y0 = q.front().s;
    	q.pop();
    	for(int i = 0; i < 4; ++i){
    		for(int j = 0; j < D[i].sz(); ++j){
    			int xn = D[i][j].f + x0, yn = D[i][j].s + y0;
    			if(!check(xn, yn)) break;
    			if(used[xn][yn]) continue;
    			used[xn][yn] = used[x0][y0] + 1;
    			q.push(mp(xn, yn));
    		}
    	}
    }
    cout << used[x][y] - 1;
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define pll pair <ll, ll>
#define f first
#define s second
#define ins insert
#define ers erase
#define rtn return
#define sz size
#define fop freopen

using namespace std;

const int maxn = (int)(2e3 + 11);
const int inf = (int)(1e9 + 7);
const int base = (int)(1e9 + 7);
const int mod = (int)(1e9 + 7);
const double eps = (double)(1e-9);

int n, m, k, x, y, x2, y2, used[maxn][maxn], pnt[maxn][maxn][4];
char c[maxn][maxn];
pii D[4][maxn];

bool check(int x, int y){
	return x >= 0 && x < n && y >= 0 && y < m && c[x][y] != '#';
}

int main(){
	//freopen("in", "r", stdin);
  	//freopen("out", "w", stdout);
    ios_base :: sync_with_stdio(false);
    cin >> n >> m >> k;
    for(int i = 0; i < n; ++i){
    	for(int j = 0; j < m; ++j){
    		cin >> c[i][j];
    	}
    }
    cin >> x >> y >> x2 >> y2;
    for(int i = 1; i <= k; ++i){
    	D[0][i - 1] = mp(-i, 0);
    	D[1][i - 1] = mp(i, 0);
    	D[2][i - 1] = mp(0, -i);
    	D[3][i - 1] = mp(0, i);
    }
    x--, y--, x2--, y2--;
    if(c[x2][y2] == '#' || c[x][y] == '#'){
        cout << -1;
        return 0;
    }
    queue <pii> q;
    q.push(mp(x2, y2));
    used[x2][y2] = 1;
    while(!q.empty() && !used[x][y]){
    	int x0 = q.front().f, y0 = q.front().s;
    	q.pop();
    	for(int i = 0; i < 4; ++i){
    		int st;
    		if(i == 0){
    			if(used[x0 - 1][y0]){
    				st = pnt[x0 - 1][y0][0] - 1;
    			} else st = k - 1;
    		}
    		if(i == 1){
    			if(used[x0 + 1][y0]){
    				st = pnt[x0 + 1][y0][1] - 1;
    			} else st = k - 1;
    		}
    		if(i == 2){
    			if(used[x0][y0 - 1]){
    				st = pnt[x0][y0 - 1][2] - 1;
    			} else st = k - 1;
    		}
    		if(i == 3){
    			if(used[x0][y0 + 1]){
    				st = pnt[x0][y0 + 1][3] - 1;
    			} else st = k - 1;
    		}
    		for(int &j = pnt[x0][y0][i]; j < k; ++j){
    			int xn = D[i][j].f + x0, yn = D[i][j].s + y0;
    			if(!check(xn, yn)) break;
    			if(used[xn][yn]) continue;
    			used[xn][yn] = used[x0][y0] + 1;
    			q.push(mp(xn, yn));
    		}
    	}
    }
    cout << used[x][y] - 1;
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define pll pair <ll, ll>
#define f first
#define s second
#define ins insert
#define ers erase
#define rtn return
#define sz size
#define fop freopen

using namespace std;

const int maxn = (int)(2e3 + 11);
const int inf = (int)(1e9 + 7);
const int base = (int)(1e9 + 7);
const int mod = (int)(1e9 + 7);
const double eps = (double)(1e-9);

int n, m, k, x, y, x2, y2, used[maxn][maxn];
short pnt[maxn][maxn][4];
char c[maxn][maxn];
pii D[4][maxn];

inline bool check(short x, short y){
	return x >= 0 && x < n && y >= 0 && y < m && c[x][y] != '#';
}

int main(){
	//freopen("in", "r", stdin);
  	//freopen("out", "w", stdout);
    scanf("%d%d%d\n", &n, &m, &k);
    for(short i = 0; i < n; ++i){
    	for(short j = 0; j < m; ++j){
    		scanf("%c", &c[i][j]);
    	}
    	scanf("\n");
    }
    scanf("%d%d%d%d", &x, &y, &x2, &y2);
    for(short i = 1; i <= k; ++i){
    	D[0][i - 1] = mp(-i, 0);
    	D[1][i - 1] = mp(i, 0);
    	D[2][i - 1] = mp(0, -i);
    	D[3][i - 1] = mp(0, i);
    }
    x--, y--, x2--, y2--;
    if(c[x2][y2] == '#' || c[x][y] == '#'){
        printf("-1");
        return 0;
    }
    queue <pii> q;
    q.push(mp(x2, y2));
    used[x2][y2] = 1;
    while(!q.empty() && !used[x][y]){
    	short x0 = q.front().f, y0 = q.front().s;
    	q.pop();
    	for(short i = 0; i < 4; ++i){
    		short st = 0;
    		if(i == 0){
    			if(used[x0 - 1][y0] && pnt[x0 - 1][y0][0]){
    				if(pnt[x0 - 1][y0][0] != k){
    					st = k;
    				} else st = k - 1;
    			}
    			if(used[x0 + 1][y0]){
    				if(pnt[x0 + 1][y0][0]){
    					st = k;
    				}
    		 	}
    		}
    		if(i == 1){
    			if(used[x0 + 1][y0] && pnt[x0 + 1][y0][1]){
    				if(pnt[x0 + 1][y0][1] != k){
    					st = k;
    				} else st = k - 1;
    			}
    			if(used[x0 - 1][y0]){
    				if(pnt[x0 - 1][y0][1]){
    					st = k;
    				}
    		 	}
    		}
    		if(i == 2){
    			if(used[x0][y0 - 1] && pnt[x0][y0 - 1][2]){
    				if(pnt[x0][y0 - 1][2] != k){
    					st = k;
    				} else st = k - 1;
    			}
    			if(used[x0][y0 + 1]){
    				if(pnt[x0][y0 + 1][2]){
    					st = k;
    				}
    		 	}
    		}
    		if(i == 3){
    			if(used[x0][y0 + 1] && pnt[x0][y0 + 1][3]){
    				if(pnt[x0][y0 + 1][3] != k){
    					st = k;
    				} else st = k - 1;
    			}
    			if(used[x0][y0 - 1]){
    				if(pnt[x0][y0 - 1][3]){
    					st = k;
    				}
    		 	}
    		}
    		pnt[x0][y0][i] = st;
    		for(short &j = pnt[x0][y0][i]; j < k; ++j){
    			short xn = D[i][j].f + x0, yn = D[i][j].s + y0;
    			if(!check(xn, yn)) break;
    			if(used[xn][yn]) continue;
    			used[xn][yn] = used[x0][y0] + 1;
    			q.push(mp(xn, yn));
    		}
    	}
    }
    printf("%d", used[x][y] - 1);
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define pll pair <ll, ll>
#define f first
#define s second
#define ins insert
#define ers erase
#define rtn return
#define sz size
#define fop freopen

using namespace std;

const int maxn = (int)(2e3 + 11);
const int inf = (int)(1e9 + 7);
const int base = (int)(1e9 + 7);
const int mod = (int)(1e9 + 7);
const double eps = (double)(1e-9);

int n, m, k, x, y, x2, y2, used[maxn][maxn];
short pnt[maxn][maxn][4];
char c[maxn][maxn];
pii D[4][maxn];

inline bool check(short x, short y){
	return x >= 0 && x < n && y >= 0 && y < m && c[x][y] != '#';
}

int main(){
	//freopen("in", "r", stdin);
  	//freopen("out", "w", stdout);
    scanf("%d%d%d\n", &n, &m, &k);
    for(short i = 0; i < n; ++i){
    	for(short j = 0; j < m; ++j){
    		scanf("%c", &c[i][j]);
    	}
    	scanf("\n");
    }
    scanf("%d%d%d%d", &x, &y, &x2, &y2);
    for(short i = 1; i <= k; ++i){
    	D[0][i - 1] = mp(-i, 0);
    	D[1][i - 1] = mp(i, 0);
    	D[2][i - 1] = mp(0, -i);
    	D[3][i - 1] = mp(0, i);
    }
    x--, y--, x2--, y2--;
    if(c[x2][y2] == '#' || c[x][y] == '#'){
        printf("-1");
        return 0;
    }
    queue <pii> q;
    q.push(mp(x2, y2));
    used[x2][y2] = 1;
    while(!q.empty() && !used[x][y]){
    	short x0 = q.front().f, y0 = q.front().s;
    	q.pop();
    	for(short i = 0; i < 4; ++i){
    		short st = 0;
    		if(i == 0){
    			if(used[x0 - 1][y0] && pnt[x0 - 1][y0][0]){
    				if(pnt[x0 - 1][y0][0] != k){
    					st = k;
    				} else st = k - 1;
    			}
    		}
    		if(i == 1){
    			if(used[x0 + 1][y0] && pnt[x0 + 1][y0][1]){
    				if(pnt[x0 + 1][y0][1] != k){
    					st = k;
    				} else st = k - 1;
    			}
    		}
    		if(i == 2){
    			if(used[x0][y0 - 1] && pnt[x0][y0 - 1][2]){
    				if(pnt[x0][y0 - 1][2] != k){
    					st = k;
    				} else st = k - 1;
    			}
    		}
    		if(i == 3){
    			if(used[x0][y0 + 1] && pnt[x0][y0 + 1][3]){
    				if(pnt[x0][y0 + 1][3] != k){
    					st = k;
    				} else st = k - 1;
    			}
    		}
    		pnt[x0][y0][i] = st;
    		for(short &j = pnt[x0][y0][i]; j < k; ++j){
    			short xn = D[i][j].f + x0, yn = D[i][j].s + y0;
    			if(!check(xn, yn)) break;
    			if(used[xn][yn]) continue;
    			used[xn][yn] = used[x0][y0] + 1;
    			q.push(mp(xn, yn));
    		}
    	}
    }
    printf("%d", used[x][y] - 1);
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define pll pair <ll, ll>
#define f first
#define s second
#define ins insert
#define ers erase
#define rtn return
#define sz size
#define fop freopen

using namespace std;

const int maxn = (int)(2e3 + 11);
const int inf = (int)(1e9 + 7);
const int base = (int)(1e9 + 7);
const int mod = (int)(1e9 + 7);
const double eps = (double)(1e-9);

int n, m, k, x, y, x2, y2, used[maxn][maxn];
short pnt[maxn][maxn][4];
char c[maxn][maxn];
pii D[4][maxn];

inline bool check(short x, short y){
	return x >= 0 && x < n && y >= 0 && y < m && c[x][y] != '#';
}

int main(){
	//freopen("in", "r", stdin);
  	//freopen("out", "w", stdout);
    scanf("%d%d%d\n", &n, &m, &k);
    for(short i = 0; i < n; ++i){
    	for(short j = 0; j < m; ++j){
    		scanf("%c", &c[i][j]);
    	}
    	scanf("\n");
    }
    scanf("%d%d%d%d", &x, &y, &x2, &y2);
    for(short i = 1; i <= k; ++i){
    	D[0][i - 1] = mp(-i, 0);
    	D[1][i - 1] = mp(i, 0);
    	D[2][i - 1] = mp(0, -i);
    	D[3][i - 1] = mp(0, i);
    }
    x--, y--, x2--, y2--;
    if(c[x2][y2] == '#' || c[x][y] == '#'){
        printf("-1");
        return 0;
    }
    queue <pii> q;
    q.push(mp(x2, y2));
    used[x2][y2] = 1;
    while(!q.empty() && !used[x][y]){
    	short x0 = q.front().f, y0 = q.front().s;
    	q.pop();
    	for(short i = 0; i < 4; ++i){
    		short st = 0;
    		if(i == 0){
    			if(used[x0 - 1][y0] && pnt[x0 - 1][y0][0]){
    				if(pnt[x0 - 1][y0][0] != k){
    					st = pnt[x0 - 1][y0][0];
    				} else st = k - 1;
    			}
    			if(used[x0 + 1][y0] <= used[x0][y0]){
    				st = 0;
    			}
    		}
    		if(i == 1){
    			if(used[x0 + 1][y0] && pnt[x0 + 1][y0][1]){
    				if(pnt[x0 + 1][y0][1] != k){
    					st = pnt[x0 + 1][y0][1];
    				} else st = k - 1;
    			}
    			if(used[x0 - 1][y0] <= used[x0][y0]){
    				st = 0;
    			}
    		}
    		if(i == 2){
    			if(used[x0][y0 - 1] && pnt[x0][y0 - 1][2]){
    				if(pnt[x0][y0 - 1][2] != k){
    					st = pnt[x0][y0 - 1][2];
    				} else st = k - 1;
    			}
    			if(used[x0][y0 + 1] <= used[x0][y0]){
    				st = 0;
    			}
    		}
    		if(i == 3){
    			if(used[x0][y0 + 1] && pnt[x0][y0 + 1][3]){
    				if(pnt[x0][y0 + 1][3] != k){
    					st = pnt[x0][y0 + 1][3];
    				} else st = k - 1;
    			}
    			if(used[x0][y0 - 1] <= used[x0][y0]){
    				st = 0;
    			}
    		}
    		pnt[x0][y0][i] = st;
    		for(short &j = pnt[x0][y0][i]; j < k; ++j){
    			short xn = D[i][j].f + x0, yn = D[i][j].s + y0;
    			if(!check(xn, yn)) break;
    			if(used[xn][yn]) continue;
    			used[xn][yn] = used[x0][y0] + 1;
    			q.push(mp(xn, yn));
    		}
    	}
    }
    printf("%d", used[x][y] - 1);
    return 0;
}


#include <iostream>
#include <unordered_map>
#include <vector>
#include <queue>
#include <set>
#include <limits>
#include <algorithm>

struct Cell {
    int row, col;
    Cell(int row, int col): row(row), col(col) {};
};

bool valid[1000][1000];
int dist[1000][1000];

int main(int argc, const char * argv[]) {
    int n, m, k;

    std::cin >> n;
    std::cin >> m;
    std::cin >> k;

    for (int i=0; i<n; i++) {
        std::string line;
        std::cin >> line;

        for (int j=0; j<m; j++) {
            if (line[j] == '.')
                valid[i][j] = true;
        }
    }

    int x1, y1, x2, y2;
    std::cin >> x1 >> y1 >> x2 >> y2;

    Cell u = {x1-1, y1-1};
    Cell v = {x2-1, y2-1};

    std::fill_n(&dist[0][0], 1000*1000, 1000000);
    std::queue<Cell> queue;
    queue.push(u);
    dist[u.row][u.col] = 0;

    while (!queue.empty()){
        Cell c = queue.front();
        queue.pop();

        if (c.row == v.row && c.col == v.col)
            break;

        int d = dist[c.row][c.col];
        int alt = d + 1;

        for (int i = c.row + 1; i <= c.row + k && i < n && valid[i][c.col]; i++) {
            if (alt < dist[i][c.col]){
                dist[i][c.col] = alt;
                queue.emplace(i,c.col);
            }
        }

        for (int i = c.row - 1; i >= c.row - k && i>=0 && valid[i][c.col]; i--) {
            if (alt < dist[i][c.col]){
                dist[i][c.col] = alt;
                queue.emplace(i,c.col);
            }
        }

        for (int j = c.col + 1; j <= c.col + k && j<m && valid[c.row][j]; j++) {
            if (alt < dist[c.row][j]){
                dist[c.row][j] = alt;
                queue.emplace(c.row,j);
            }
        }

        for (int j = c.col - 1; j >= c.col - k && j>=0 && valid[c.row][j]; j--) {
            if (alt < dist[c.row][j]){
                dist[c.row][j] = alt;
                queue.emplace(c.row,j);
            }
        }
    }

    if (dist[v.row][v.col] == 1000000){
        std::cout << -1;
    } else {
        std::cout << dist[v.row][v.col];
    }

    return 0;
}


//
//  main.cpp
//  olya_and_energy_drinks-877D
//
//  Created by Rafael on 2018-11-26.
//  Copyright © 2018 Rafael. All rights reserved.
//

#include <iostream>
#include <unordered_map>
#include <vector>
#include <queue>
#include <set>
#include <limits>
#include <algorithm>

int getid(int row, int col, int nrows, int ncols){
    if (row >= nrows ||
        col >= ncols ||
        row < 0      ||
        col < 0)
        return -1;

    return row*ncols + col;
}

struct Cell {
    int row, col;
    Cell(int row, int col): row(row), col(col) {};
};

int main(int argc, const char * argv[]) {
    int n, m, k;

    std::cin >> n;
    std::cin >> m;
    std::cin >> k;

    // read grid input and store unavailable cells
    bool valid[1000][1000];

    for (int i=0; i<n; i++) {
        std::string line;
        std::cin >> line;

        for (int j=0; j<m; j++) {
            if (line[j] == '.')
                valid[i][j] = true;
        }
    }

    int x1, y1, x2, y2;
    std::cin >> x1 >> y1 >> x2 >> y2;

    Cell u = {x1-1, y1-1};
    Cell v = {x2-1, y2-1};

    static int dist[1000][1000];
    std::fill_n( &dist[0][0], 1000*1000, 1000000);
    std::queue<Cell> queue;
    queue.push(u);
    dist[u.row][u.col] = 0;

    while (!queue.empty()){
        Cell c = queue.front();
        queue.pop();

        if (c.row == v.row && c.col == v.col)
            break;

        int d = dist[c.row][c.col];

        for (int i = c.row + 1; i <= c.row + k && valid[i][c.col] && i < n; i++) {
            int alt = d + 1;
            if (alt < dist[i][c.col]){
                dist[i][c.col] = alt;
                queue.push(Cell(i,c.col));
            }
        }

        for (int i = c.row - 1; i >= c.row - k && valid[i][c.col] && i>=0; i--) {
            int alt = d + 1;
            if (alt < dist[i][c.col]){
                dist[i][c.col] = alt;
                queue.push(Cell(i,c.col));
            }
        }

        for (int j = c.col + 1; j <= c.col + k && valid[c.row][j] && j<m; j++) {
            int alt = d + 1;
            if (alt < dist[c.row][j]){
                dist[c.row][j] = alt;
                queue.push(Cell(c.row,j));
            }
        }

        for (int j = c.col - 1; j >= c.col - k && valid[c.row][j] && j>=0; j--) {
            int alt = d + 1;
            if (alt < dist[c.row][j]){
                dist[c.row][j] = alt;
                queue.push(Cell(c.row,j));
            }
        }
    }

    if (dist[v.row][v.col] == 1000000){
        std::cout << -1;
    } else {
        std::cout << dist[v.row][v.col];
    }

    return 0;
}


#include <iostream>
#include <unordered_map>
#include <vector>
#include <queue>
#include <set>
#include <limits>

class Graph {
public:
    // an edge is a tuple that stores the endpoint and the direction
    // (a char, like 's' for south)
    std::unordered_map<int, std::vector<std::tuple<int, char>>> edges;

    int shortest_path(int u, int v, int speed){
        // Dijkstra's algorithm
        // Return minimum cost

        std::unordered_map<int, int> time;
        std::unordered_map<int, int> run_dist;
        std::unordered_map<int, int> prev_node;
        std::unordered_map<int, int> prev_direction;
        bool visited[1000000] = {false};

        auto comparator = [&] (int left, int right) { return time[left] > time[right]; };

        std::priority_queue<int, std::vector<int>, decltype(comparator)> queue(comparator);

        for (auto &kv : edges){
            int node = kv.first;

            time[node] = node == u ? 0 : std::numeric_limits<int>::max();

            prev_node[node] = -1;
            prev_direction[node] = ' ';
        }

        run_dist[u] = 0;

        queue.push(u);

        while (!queue.empty()){
            int node = queue.top();
            queue.pop();

            if (visited[node]) continue;
            else visited[node] = true;

            for (std::tuple<int, char> edge : edges[node]){
                int neighbor  = std::get<0>(edge);
                int direction = std::get<1>(edge);

                int delta = 0;
                if (direction != prev_direction[node] ||
                    run_dist[node] == speed)
                    delta = 1;

                int alt = time[node] + delta;
                if (alt < time[neighbor]){
                    time[neighbor] = alt;
                    prev_node[neighbor] = node;
                    prev_direction[neighbor] = direction;
                    run_dist[neighbor] = delta == 0 ? run_dist[node] + 1 : 1;

                    if (neighbor == v) break;

                    queue.push(neighbor);
                }
            }
        }

        if (prev_node.find(v) == prev_node.end() || prev_node[v] == -1)
            return -1;

        return time[v];
    }

    void add_edge(int u, int v, char direction){
        edges[u].push_back(std::make_tuple(v, direction));
    }

};

int getid(int row, int col, int nrows, int ncols){
    if (row >= nrows ||
        col >= ncols ||
        row < 0      ||
        col < 0)
        return -1;

    return row*ncols + col;
}

bool is_in(std::set<int> a_set, int key){
    return a_set.find(key) != a_set.end();
}

int main(int argc, const char * argv[]) {
    int n, m, k;

    std::cin >> n;
    std::cin >> m;
    std::cin >> k;

    // read grid input and store unavailable cells
    bool deadcells[1000000] = {false};
    //    std::set<int> deadcells;
    for (int i=0; i<n; i++) {
        std::string line;
        std::cin >> line;
        for (int j=0; j<m; j++) {
            if (line[j] == '#')
                deadcells[getid(i, j, n, m)] = true;
            //                deadcells.insert(getid(i, j, n, m));
        }
    }

    // attempt to insert the whole grid in the graph
    // but skip connections with unavailable cells

    Graph graph;

    for (int i=0; i<n; i++) {
        for (int j=0; j<m; j++) {
            int current = getid(i, j, n, m);

            if (deadcells[current])
                continue;

            int north = getid(i-1, j, n, m),
            south = getid(i+1, j, n, m),
            east  = getid(i, j+1, n, m),
            west  = getid(i, j-1, n, m);

            if (east > -1 && !deadcells[east])
                graph.add_edge(current, east, 'e');
            if (west > -1 && !deadcells[west])
                graph.add_edge(current, west, 'w');
            if (north > -1 && !deadcells[north])
                graph.add_edge(current, north, 'n');
            if (south > -1 && !deadcells[south])
                graph.add_edge(current, south, 's');

        }
    }

    // read query
    int x1, y1, x2, y2;
    std::cin >> x1 >> y1 >> x2 >> y2;

    int id1 = getid(x1-1, y1-1, n, m);
    int id2 = getid(x2-1, y2-1, n, m);

    std::cout << graph.shortest_path(id1, id2, k);
    return 0;
}


//
//  main.cpp
//  olya_and_energy_drinks-877D
//
//  Created by Rafael on 2018-11-26.
//  Copyright © 2018 Rafael. All rights reserved.
//

#include <iostream>
#include <unordered_map>
#include <vector>
#include <queue>
#include <set>
#include <limits>

// A simple object for priority queues
struct Pnode
{
    int score;
    int value;

    Pnode(int s, int v) : score(s), value(v){}

    bool operator<(const struct Pnode& other) const{
        return score < other.score;
    }
};

class Graph {
public:
    // an edge is a tuple that stores the endpoint and the direction
    // (a char, like 's' for south)
    std::unordered_map<int, std::vector<std::tuple<int, char>>> edges;

    int shortest_path(int u, int v, int speed){
        // Dijkstra's algorithm
        // Return minimum cost

        std::unordered_map<int, int> time;
        std::unordered_map<int, int> run_dist;
        std::unordered_map<int, int> prev_node;
        std::unordered_map<int, int> prev_direction;
        bool visited[1000000] = {false};

        auto comparator = [&] (int left, int right) { return time[left] > time[right]; };

        std::priority_queue<int, std::vector<int>, decltype(comparator)> queue(comparator);

        for (auto &kv : edges){
            int node = kv.first;

            time[node] = node == u ? 0 : std::numeric_limits<int>::max();

            prev_node[node] = -1;
            prev_direction[node] = ' ';
        }

        queue.push(u);

        while (!queue.empty()){
            int node = queue.top();
            queue.pop();

            if (visited[node]) continue;
            else visited[node] = true;

            if (node == v) break;

            for (std::tuple<int, char> edge : edges[node]){
                int neighbor  = std::get<0>(edge);
                int direction = std::get<1>(edge);

                int delta = 0;
                if (direction != prev_direction[node] ||
                    run_dist[node] == speed)
                    delta = 1;

                int alt = time[node] + delta;
                if (alt < time[neighbor]){
                    time[neighbor] = alt;
                    prev_node[neighbor] = node;
                    prev_direction[neighbor] = direction;
                    run_dist[neighbor] = delta == 0 ? run_dist[node] + 1 : 1;
                    queue.push(neighbor);
                }
            }
        }

        if (prev_node.find(v) == prev_node.end() || prev_node[v] == -1)
            return -1;

        return time[v];
    }

    void add_edge(int u, int v, char direction){
        edges[u].push_back(std::make_tuple(v, direction));
    }

};

int getid(int row, int col, int nrows, int ncols){
    if (row >= nrows ||
        col >= ncols ||
        row < 0      ||
        col < 0)
        return -1;

    return row*ncols + col;
}

bool is_in(std::set<int> a_set, int key){
    return a_set.find(key) != a_set.end();
}

int main(int argc, const char * argv[]) {
    int n, m, k;

    std::cin >> n;
    std::cin >> m;
    std::cin >> k;

    // read grid input and store unavailable cells
    bool deadcells[1000000] = {false};
    //    std::set<int> deadcells;
    for (int i=0; i<n; i++) {
        std::string line;
        std::cin >> line;
        for (int j=0; j<m; j++) {
            if (line[j] == '#')
                deadcells[getid(i, j, n, m)] = true;
            //                deadcells.insert(getid(i, j, n, m));
        }
    }

    // attempt to insert the whole grid in the graph
    // but skip connections with unavailable cells

    Graph graph;

    for (int i=0; i<n; i++) {
        for (int j=0; j<m; j++) {
            int current = getid(i, j, n, m);

            if (deadcells[current])
                continue;

            int north = getid(i-1, j, n, m),
            south = getid(i+1, j, n, m),
            east  = getid(i, j+1, n, m),
            west  = getid(i, j-1, n, m);

            if (north > -1 && !deadcells[north])
                graph.add_edge(current, north, 'n');
            if (south > -1 && !deadcells[south])
                graph.add_edge(current, south, 's');
            if (west > -1 && !deadcells[west])
                graph.add_edge(current, west, 'w');
            if (east > -1 && !deadcells[east])
                graph.add_edge(current, east, 'e');
        }
    }

    // read query
    int x1, y1, x2, y2;
    std::cin >> x1 >> y1 >> x2 >> y2;

    int id1 = getid(x1-1, y1-1, n, m);
    int id2 = getid(x2-1, y2-1, n, m);

    std::cout << graph.shortest_path(id1, id2, k);

    return 0;
}