#include<bits/stdc++.h>
using namespace std;
#define task "codeforces"
#define rep(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define per(i,b,a) for(int i=(b),_a=(a);i>=_a;--i)
#define BIT(x, i) (((x) >> (i)) & 1)
#define lb lower_bound
#define ub upper_bound
#define lla(v) (v).begin(),(v).end()
#define zs(v) int((v).size())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1000000007; /// 998244353
const int base=311;
const int N=1e5+5;

int n,k,a[N];
pii f[N];
map<int,int> cnt;
void solved()
{
    cin>>n>>k;
    for(int i=1;i<=n;++i) cin>>a[i];
    int ok=0;
    for(int i=1;i<=n;++i)
    {
        if(a[i]==k) {ok=1; break;}
    }
    if(!ok) {cout<<"no\n"; return;}
    if(ok&&n==1)
    {
        cout<<"yes\n";
        return;
    }
    for(int i=2;i<=n;++i)
    {
        if(a[i]==a[i-1]&&a[i]==k)
        {
            cout<<"yes\n";
            return;
        }
    }
    for(int i=1;i<=n;++i) f[i].fi=f[i-1].fi+(a[i]<=k?1:-1), f[i].se=i;
    sort(f,f+n+1);
    for(int i=-n;i<=n;++i) cnt[i]=1e9;
    int ans=0;
    for(int i=0;i<=n;++i)
    {
        cnt[f[i].fi]=min(cnt[f[i].fi],f[i].se);
        ans=max(ans,f[i].se-cnt[f[i].fi]);
    }
    if(ans>=2)
    {
        cout<<"yes\n";
    }
    else cout<<"no\n";
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(fopen(task".inp","r"))
    {
        freopen(task".inp","r",stdin);
        freopen(task".out","w",stdout);
    }
    int t;
    cin>>t;
    while(t--) solved();
}


#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
/*
    vec1.size();
    str1.length();
    vec1.pop_back;
*/
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef vector<pll> vplll;
#define rep(i,l,r) for (ll i = l; i < r; ++i)
#define reprev(i,l,r) for (ll i = r; i >= l; --i)
ll mod = 1e9+7;
ll expo_mod(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y%2==1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T,fg,n,k;
    ll arr[100005];
    cin>>T;
    while(T--)
    {
        cin>>n>>k;
        ll gt[n+1];
        ll lt[n+1];
        vector <ll> vec1;
        rep(i,0,n)
        {
            cin>>arr[i];
            if(arr[i]==k)
            {
                vec1.pb(i);
            }
            else if(arr[i]<k)
            {
                lt[i]++;
            }
            else
            {
                gt[i]++;
            }
            if(i!=0)
            {

                lt[i]+=lt[i-1];
                gt[i]+=gt[i-1];
            }
        }
        if(n==1)
        {
            cout<<"yes\n";
            continue;
        }
        fg=0;
        rep(i,1,n)
        {
            if(arr[i]==k)
            {
                if(arr[i-1]>=arr[i])
                {
                    fg=1;
                    break;
                }
            }
        }
        rep(i,0,n-1)
        {
            if(arr[i]==k)
            {
                if(arr[i+1]>=arr[i])
                {
                    fg=1;
                    break;
                }
            }
        }
        if(fg)
        {
            cout<<"yes\n";
        }
        else
        {
            ll sz=vec1.size();
            // cout<<"no\n";
            rep(j,0,sz)
            {
                if(j!=sz-1)
                {
                    rep(i,vec1[j],vec1[j+1])
                    {
                        if(lt[i]==gt[i] || lt[i]==gt[i]-1)
                        {
                            fg=1;
                            break;
                        }
                        if(fg)
                        break;
                    }
                }
                else
                {

                    rep(i,vec1[j],n)
                    {
                        if(lt[i]==gt[i] || lt[i]==gt[i]-1)
                        {
                            fg=1;
                            break;
                        }
                        if(fg)
                        break;

                }

                // t++;
            }
            if(fg)
            break;
        }
        }

        if(fg)
        {
            cout<<"yes\n";
        }
        else
        {
            // ll sz=vec1.size();
            cout<<"no\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
/*
    vec1.size();
    str1.length();
    vec1.pop_back;
*/
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef vector<pll> vplll;
#define rep(i,l,r) for (ll i = l; i < r; ++i)
#define reprev(i,l,r) for (ll i = r; i >= l; --i)
ll mod = 1e9+7;
ll expo_mod(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y%2==1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T,n,k,fg,fg2;
    ll arr[100005];
    cin>>T;
    while (T--)
    {
        cin>>n>>k;
        fg=0;
        rep(i,0,n)
        {
            cin>>arr[i];
            if(arr[i]<k)
            {
                arr[i]=0;
            }
            else if(arr[i]==k)
            {
                arr[i]=1;
                fg=1;
            }
            else
            {
                arr[i]=2;
            }
        }
        if(n==1)
        {
            if(arr[0]==1)
            {
                cout<<"yes\n";
                continue;
            }
            else
            {
                cout<<"no\n";
                continue;
            }

        }
        fg2=0;
        rep(i,0,n-1)
        {
            if(arr[i] >0 && arr[i+1]>0)
            {
                fg2=1;
                break;
            }
        }
        if(!fg2)
        {
            rep(i,0,n-2)
            {
                if(arr[i]>0 && arr[i+2]>0)
                {
                    fg2=1;
                    break;
                }
            }
        }
        if(fg && fg2)
        {
            cout<<"yes\n";
        }
        else
        {
            cout<<"no\n";
        }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
/*
    vec1.size();
    str1.length();
    vec1.pop_back;
*/
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef vector<pll> vplll;
#define rep(i,l,r) for (ll i = l; i < r; ++i)
#define reprev(i,l,r) for (ll i = r; i >= l; --i)
ll mod = 1e9+7;
ll expo_mod(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y%2==1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T,fg,n,k;
    ll arr[100005];
    cin>>T;
    while(T--)
    {
        cin>>n>>k;
        rep(i,0,n)
        {
            cin>>arr[i];
        }
        if(n==1)
        {
            cout<<"yes\n";
            continue;
        }
        fg=0;
        rep(i,1,n)
        {
            if(arr[i]==k)
            {
                if(arr[i-1]>=arr[i])
                {
                    fg=1;
                    break;
                }
            }
        }
        rep(i,0,n-1)
        {
            if(arr[i]==k)
            {
                if(arr[i+1]>=arr[i])
                {
                    fg=1;
                    break;
                }
            }
        }
        if(fg)
        {
            cout<<"yes\n";
        }
        else
        {
            cout<<"no\n";
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
/*
    vec1.size();
    str1.length();
    vec1.pop_back;
*/
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef vector<pll> vplll;
#define rep(i,l,r) for (ll i = l; i < r; ++i)
#define reprev(i,l,r) for (ll i = r; i >= l; --i)
ll mod = 1e9+7;
ll expo_mod(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y%2==1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T,fg,n,k;
    ll arr[100005];
    cin>>T;
    while(T--)
    {
        cin>>n>>k;
        ll gt[n+1];
        ll lt[n+1];
        vector <ll> vec1;
        rep(i,0,n)
        {
            cin>>arr[i];
            if(arr[i]==k)
            {
                vec1.pb(i);
            }
            else if(arr[i]<k)
            {
                lt[i]++;
            }
            else
            {
                gt[i]++;
            }
            if(i!=0)
            {

                lt[i]+=lt[i-1];
                gt[i]+=gt[i-1];
            }
        }
        if(n==1)
        {
            cout<<"yes\n";
            continue;
        }
        fg=0;
        rep(i,1,n)
        {
            if(arr[i]==k)
            {
                if(arr[i-1]>=arr[i])
                {
                    fg=1;
                    break;
                }
            }
        }
        rep(i,0,n-1)
        {
            if(arr[i]==k)
            {
                if(arr[i+1]>=arr[i])
                {
                    fg=1;
                    break;
                }
            }
        }
        if(fg)
        {
            cout<<"yes\n";
        }
        else
        {
            ll sz=vec1.size();
            // cout<<"no\n";
            rep(j,0,sz)
            {
                if(j!=sz-1)
                {
                    rep(i,vec1[j],vec1[j+1])
                    {
                        if(lt[i]==gt[i] || lt[i]==gt[i]-1)
                        {
                            fg=1;
                            break;
                        }
                        if(fg)
                        break;
                    }
                }
                else
                {

                    rep(i,vec1[j],n)
                    {
                        if(lt[i]==gt[i] || lt[i]==gt[i]-1)
                        {
                            fg=1;
                            break;
                        }
                        if(fg)
                        break;

                }

                // t++;
            }
            if(fg)
            break;
        }

        if(fg)
        {
            cout<<"yes\n";
        }
        else
        {
            // ll sz=vec1.size();
            cout<<"no\n";
        }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
/*
    vec1.size();
    str1.length();
    vec1.pop_back;
*/
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef vector<pll> vplll;
#define rep(i,l,r) for (ll i = l; i < r; ++i)
#define reprev(i,l,r) for (ll i = r; i >= l; --i)
ll mod = 1e9+7;
ll expo_mod(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y%2==1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T,n,k,fg,fg2;
    ll arr[100005];
    cin>>T;
    while (T--)
    {
        cin>>n>>k;
        fg=0;
        rep(i,0,n)
        {
            cin>>arr[i];
            if(arr[i]<k)
            {
                arr[i]=0;
            }
            else if(arr[i]==k)
            {
                arr[i]=1;
                fg=1;
            }
            else
            {
                arr[i]=2;
            }
        }
        if(n==1)
        {
            if(arr[0]==1)
            {
                cout<<"yes\n";
                continue;
            }
            else
            {
                cout<<"no\n";
                continue;
            }

        }
        fg2=0;
        rep(i,0,n-1)
        {
            if(arr[i] >0 && arr[i+1]>0)
            {
                fg2=1;
                break;
            }
        }
        if(!fg2)
        {
            rep(i,0,n-2)
            {
                if(arr[i]>0 && arr[n+2]>0)
                {
                    fg2=1;
                    break;
                }
            }
        }
        if(fg && fg2)
        {
            cout<<"yes\n";
        }
        else
        {
            cout<<"no\n";
        }

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
/*
    vec1.size();
    str1.length();
    vec1.pop_back;
*/
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef vector<pll> vplll;
#define rep(i,l,r) for (ll i = l; i < r; ++i)
#define reprev(i,l,r) for (ll i = r; i >= l; --i)
ll mod = 1e9+7;
ll expo_mod(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y%2==1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T,fg,n,k;
    ll arr[100005];
    cin>>T;
    while(T--)
    {
        fg=0;
        cin>>n>>k;
        ll gt[n+1];
        ll lt[n+1];
        vector <ll> vec1;
        rep(i,0,n)
        {
            cin>>arr[i];
            if(arr[i]==k)
            {
                vec1.pb(i);
            }
            else if(arr[i]<k)
            {
                lt[i]++;
            }
            else
            {
                gt[i]++;
            }
            if(i!=0)
            {

                lt[i]+=lt[i-1];
                gt[i]+=gt[i-1];
            }
        }
        if(n==1)
        {
            if(arr[0]==k)
            {

            cout<<"yes\n";
            }
            else
            {
                cout<<"no\n";
            }

            continue;
        }
        fg=0;
        rep(i,1,n)
        {
            if(arr[i]==k)
            {
                if(arr[i-1]>=arr[i])
                {
                    fg=1;
                    break;
                }
            }
        }
        rep(i,0,n-1)
        {
            if(arr[i]==k)
            {
                if(arr[i+1]>=arr[i])
                {
                    fg=1;
                    break;
                }
            }
        }
        if(fg)
        {
            cout<<"yes\n";
        }
        else
        {
            ll sz=vec1.size();
            // cout<<"no\n";
            rep(j,0,sz)
            {
                if(j!=sz-1)
                {
                    rep(i,vec1[j],vec1[j+1])
                    {
                        if(lt[i]==gt[i] || lt[i]==gt[i]-1)
                        {
                            fg=1;
                            break;
                        }
                        if(fg)
                        break;
                    }
                }
                else
                {

                    rep(i,vec1[j],n)
                    {
                        if(lt[i]==gt[i] || lt[i]==gt[i]-1)
                        {
                            fg=1;
                            break;
                        }
                        if(fg)
                        break;

                }

                // t++;
            }
            if(fg)
            break;
        }

        if(fg)
        {
            cout<<"yes\n";
        }
        else
        {
            // ll sz=vec1.size();
            cout<<"no\n";
        }
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define nl "\n"
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll t;
	cin >> t;
	ll n,k,flag,res;
	while(t--!=0){
		cin >> n >> k;
		flag=res=0;
		ll a[n];
		rep(i,0,n){
			cin >> a[i];
			if(a[i]==k)
				flag=1;
			if(a[i]<k)
				a[i]=0;
			else
				a[i]=1;
			if(a[i]==1 && a[i-1]==1){
				res=1;
			}
		}
		if(n==1 && flag){
			cout << "yes\n";
			continue;
		}
		if(!flag){
			cout << "no\n";
			continue;
		}
		if(res)
			cout << "yes\n";
		else
			cout << "no" <<  nl;
	}

	return 0;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define nl "\n"
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll t;
	cin >> t;
	ll n,k,flag,res;
	while(t--!=0){
		cin >> n >> k;
		flag=res=0;
		ll a[n];
		rep(i,0,n){
			cin >> a[i];
			if(a[i]==k)
				flag=1;
			if(a[i]<k)
				a[i]=0;
			else
				a[i]=1;
			if(i>0 && a[i]==1 && a[i-1]==1){
				res=1;
			}
		}
		if(n==1 && flag){
			cout << "yes\n";
			continue;
		}
		if(!flag){
			cout << "no\n";
			continue;
		}
		if(res)
			cout << "yes\n";
		else
			cout << "no" <<  nl;
	}

	return 0;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define nl "\n"
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll t;
	cin >> t;
	ll n,k,flag,res;
	while(t--!=0){
		cin >> n >> k;
		flag=0;
		ll a[n];
		rep(i,0,n){
			cin >> a[i];
			if(a[i]==k)
				flag=1;
			if(a[i]>=k)
				a[i]=1;
			else
				a[i]=0;
		}
		if(n==1){
			if(flag)
				cout  << "yes\n";
			else
				cout << "no\n";
			continue;
		}
		int res=0;
		if(flag){
			rep(i,1,n)
				if(a[i]==a[i-1] && a[i]==1){
					res=1;
					break;
				}
			if(res)
				cout << "yes\n";
			else
				cout << "no\n";

		}
		else
			cout << "no\n";

	}

	return 0;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define nl "\n"
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll t;
	cin >> t;
	ll n,k,flag,res;
	while(t--!=0){
		cin >> n >> k;
		flag=0;
		ll a[n];
		string s="";
		rep(i,0,n){
			cin >> a[i];
			if(a[i]==k)
				flag=1;
			if(a[i]>=k)
				s+="1";
			else
				s+="0";
		}
		if(n==1)
			s+="1";
		if(flag){
			// cout << s << nl;
			// cout << s.find("11") << " " << s.find("101") << nl;
			if(s.find("11")!=string::npos || s.find("101")!=string::npos)
				cout << "yes\n";
			else
				cout << "no\n";
		}
		else
			cout << "no\n";

	}

	return 0;

}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define bit(x) (1LL << x)
#define PI acos(-1.0)
#define EPS 1e-9

#define mod 1000000007
#define maxn 200005

using namespace std;

using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///All indexing is 0-based
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

typedef long long ll;
typedef double ld;
typedef pair<ll, ll> par;

int N,K,A[maxn],cont,y , arr[5],c;

int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    tests(r){

        cin >> N >> K;

        y=cont=0;
        for(int i=1;i<=N;i++){
            cin >> A[i];
            if(A[i]==K)
                cont++;
        }
        for(int i=2;i<=N && !y;i++){
            if(min(A[i],A[i-1])>=K)
                y=1;
            if(i>=3){
                arr[0] = A[i-2] , arr[1] = A[i-1], arr[2] = A[i];
                sort(arr,arr+3);
                if(arr[1]>=K)
                    y=1;
            }
        }

          if(N <= 2){
            if(A[1]==K)
                cout << "yes\n";
            else
                cout << "no\n";
            continue;
        }

        if(y && cont)
            cout << "yes\n";
        else
            cout << "no\n";

    }
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define bit(x) (1LL << x)
#define PI acos(-1.0)
#define EPS 1e-9

#define mod 1000000007
#define maxn 200005

using namespace std;

using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///All indexing is 0-based
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

typedef long long ll;
typedef double ld;
typedef pair<ll, ll> par;

int N,K,A[maxn],cont,y , B[maxn],T[maxn],c;
map<int,int> M;

void update(int pos)
{
    for(int i=pos;i<=N;i+=(i & -i))
        B[i]++;
}
int  query(int pos)
{
    int ret=0;
    for(int i=pos;i>0;i-=(i & -i))
        ret+=B[i];
    return ret;
}
int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    tests(r){

        cin >> N >> K;

        for(int i=1;i<=N;i++){
            cin >> A[i];
            T[i]=0;
            if(A[i]>K)
                T[i]=1;
            else if(A[i]<K)
                    T[i] = -1;
                else
                    update(i);

        }

          if(N <= 2){
            if(A[1]==K)
                cout << "yes\n";
            else
                cout << "no\n";
            continue;
        }

        for(int i=1;i<=N;i++){
            T[i]+=T[i-1];
            int pos = 1<<30;
            if(M.find(T[i])!=M.end())
                pos = min(pos,M[T[i]]);
            if(M.find(T[i]-1)!=M.end())
                pos = min(pos,M[T[i]]);
            if(pos!=1<<30 && pos!=i-1){
              c = query(i) - query(pos-1);
              if(c){
                  y=1;
                  break;
                }
            }
            if(M.find(T[i])==M.end())
                M[T[i]]=i;
        }

        if(y)
            cout << "yes\n";
        else
            cout << "no\n";

        M.clear();
        y=0;
        for(int i=1;i<=N;i++)
            B[i]=T[i]=0;

    }
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define bit(x) (1LL << x)
#define PI acos(-1.0)
#define EPS 1e-9

#define mod 1000000007
#define maxn 200005

using namespace std;

using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///All indexing is 0-based
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

typedef long long ll;
typedef double ld;
typedef pair<ll, ll> par;

int N,K,A[maxn],cont,y , arr[5],c;

int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    tests(r){

        cin >> N >> K;

        y=cont=0;
        for(int i=1;i<=N;i++){
            cin >> A[i];
            if(A[i]==K)
                cont++;
        }
        for(int i=2;i<=N && !y;i++){
            if(min(A[i],A[i-1])>=K)
                y=1;
            if(i>=3){
                arr[0] = A[i-2] , arr[1] = A[i-1], arr[2] = A[i];
                sort(arr,arr+3);
                if(arr[1]>=K)
                    y=1;
            }
        }

          if(N <= 2){
            A[N+1]=1<<30;
            if(min(A[1],A[2])==K)
                cout << "yes\n";
            else
                cout << "no\n";
            continue;
        }

        if(y && cont)
            cout << "yes\n";
        else
            cout << "no\n";

    }
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define bit(x) (1LL << x)
#define PI acos(-1.0)
#define EPS 1e-9

#define mod 1000000007
#define maxn 200005

using namespace std;

using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///All indexing is 0-based
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

typedef long long ll;
typedef double ld;
typedef pair<ll, ll> par;

int N,K,A[maxn],cont,y , arr[5],c;

int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    tests(r){

        cin >> N >> K;

        for(int i=1;i<=N;i++){
            cin >> A[i];
            if(A[i]==K)
                cont++;
        }
        for(int i=2;i<=N && !y;i++){
            if(min(A[i],A[i-1])>=K)
                y=1;
            if(i>=3){
                arr[0] = A[i-2] , arr[1] = A[i-1], arr[2] = A[i];
                sort(arr,arr+3);
                if(arr[1]>=K)
                    y=1;
            }
        }

          if(N <= 2){
            if(A[1]==K)
                cout << "yes\n";
            else
                cout << "no\n";
            continue;
        }

        if(y && cont)
            cout << "yes\n";
        else
            cout << "no\n";

        y=cont=0;

    }
}


#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define bit(x) (1LL << x)
#define PI acos(-1.0)
#define EPS 1e-9

#define mod 1000000007
#define maxn 200005

using namespace std;

using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///All indexing is 0-based
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

typedef long long ll;
typedef double ld;
typedef pair<ll, ll> par;

int N,K,A[maxn],cont,y , arr[5],c;

int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    tests(r){

        cin >> N >> K;

        y=cont=0;
        for(int i=1;i<=N;i++){
            cin >> A[i];
            if(A[i]==K)
                cont++;
        }
        for(int i=2;i<=N && !y;i++){
            if(min(A[i],A[i-1])>=K)
                y=1;
            if(i>=3){
                arr[0] = A[i-2] , arr[1] = A[i-1], arr[2] = A[i];
                sort(arr,arr+3);
                if(arr[1]>=K)
                    y=1;
            }
        }

          if(N <= 2){
            if(min(A[1],A[2])==K)
                cout << "yes\n";
            else
                cout << "no\n";
            continue;
        }

        if(y && cont)
            cout << "yes\n";
        else
            cout << "no\n";

    }
}


#include <bits/stdc++.h>
using namespace std;
int n,m,T,k,a[200010],b[200010],cnt;
int main()
{
	scanf("%d",&T);
	while (T--)
	{
		scanf("%d%d",&n,&k);
		for (int i=1;i<=n;i++) scanf("%d",&a[i]);
		int flag=0;
		for (int i=1;i<=n;i++)
		if (a[i]==k)
		{
			if (a[i-1]>=a[i]||a[i+1]>=a[i]) flag=1;
		}
		if (flag||n==1&&k==a[1]) printf("yes\n"); else printf("no\n");
	}
}


#include <bits/stdc++.h>
using namespace std;
int n,m,T,k,a[200010],b[200010],cnt;
int main()
{
	scanf("%d",&T);
	while (T--)
	{
		scanf("%d%d",&n,&k);
		a[n+1]=0;
		for (int i=1;i<=n;i++) scanf("%d",&a[i]);
		int flag=0;
		for (int i=1;i<=n;i++)
		if (a[i]==k)
		{
			if (a[i-1]>=a[i]||a[i+1]>=a[i]) flag=1;
		}
		if (flag||n==1&&k==a[1]) printf("yes\n"); else printf("no\n");
	}
}


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

bool get_ans(vector<int> &arr, int n, int k)
{
	bool ans=false;
	for(int i=0;i<n;i++)
	{
		if(arr[i]>=k)
		{
			if(i+1<n && arr[i+1]>=k)
				return true;
		}
	}

	return false;
}

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
	int n,k;
	cin>>n>>k;
	bool flag=false;
	vector<int> arr(n);
	for(int i=0;i<n;i++)
	{
	cin>>arr[i];
	if(arr[i]==k)
	flag=true;
	}
	if(!flag)
	{
	cout<<"no"<<endl;
	continue;}
	if(flag && n==1)
	{
	cout<<"yes"<<endl;
	continue;}

	bool ans = get_ans(arr,n,k);
	if(ans)
	cout<<"yes"<<endl;
	else
	cout<<"no"<<endl;
	}
	return 0;
}


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

bool get_ans(vector<int> &arr, int n, int k)
{
	bool ans=false;
	for(int i=0;i<n;i++)
	{
		if(arr[i]>=k)
		{
			if(i+1<n && arr[i+1]>=k)
				return true;
		}
	}

	return false;
}

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
	int n,k;
	cin>>n>>k;
	bool flag=false;
	vector<int> arr(n);
	for(int i=0;i<n;i++)
	{
	cin>>arr[i];
	if(arr[i]==k)
	flag=true;
	}
	if(!flag)
	{
	cout<<"no"<<endl;
	continue;}
	bool ans = get_ans(arr,n,k);
	if(ans)
	cout<<"yes"<<endl;
	else
	cout<<"no"<<endl;
	}
	return 0;
}


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

bool get_ans(vector<int> &arr, int n, int k)
{
	bool ans=false;
	for(int i=0;i<n;i++)
	{
		if(arr[i]>=k)
		{
			if(i+1<n && arr[i]<=arr[i+1])
				return true;
		}
	}

	return false;
}

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
	int n;
	cin>>n;
	int k;
	cin>>k;
	bool flag=false;
	vector<int> arr(n);
	for(int i=0;i<n;i++)
	{
	cin>>arr[i];
	if(arr[i]==k)
	flag=true;
	}
	if(!flag)
	cout<<"no"<<endl;
	continue;
	bool ans = get_ans(arr,n,k);
	if(ans)
	cout<<"yes"<<endl;
	else
	cout<<"no"<<endl;
	}
	return 0;
}


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

bool get_ans(vector<int> &arr, int n, int k)
{
	bool ans=false;
	for(int i=0;i<n;i++)
	{
		if(arr[i]>=k)
		{
			if(i+1<n && arr[i]<=arr[i+1])
				return true;
		}
	}

	return false;
}

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
	int n,k;
	cin>>n>>k;
	bool flag=false;
	vector<int> arr(n);
	for(int i=0;i<n;i++)
	{
	cin>>arr[i];
	if(arr[i]==k)
	flag=true;
	}
	if(!flag)
	cout<<"no"<<endl;
	continue;
	bool ans = get_ans(arr,n,k);
	if(ans)
	cout<<"yes"<<endl;
	else
	cout<<"no"<<endl;
	}
	return 0;
}


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

bool get_ans(vector<int> &arr, int n, int k)
{
	bool ans=false;
	for(int i=0;i<n;i++)
	{
		if(arr[i]>=k)
		{
			if(i+1<n && arr[i+1]>=k)
				return true;
			if(i+2<n && arr[i+2]>=k)
				return true;
		}
	}

	return false;
}

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
	int n,k;
	cin>>n>>k;
	bool flag=false;
	vector<int> arr(n);
	for(int i=0;i<n;i++)
	{
	cin>>arr[i];
	if(arr[i]==k)
	flag=true;
	}
	if(!flag)
	{
	cout<<"no"<<endl;
	continue;}
	if(flag && n==1)
	{
	cout<<"yes"<<endl;
	continue;}

	bool ans = get_ans(arr,n,k);
	if(ans)
	cout<<"yes"<<endl;
	else
	cout<<"no"<<endl;
	}
	return 0;
}


//不等,不问,不犹豫,不回头.
#include<bits/stdc++.h>
#define _ 0
#define db double
#define RE register
#define ll long long
#define P 1000000007
#define INF 1000000000
#define get(x) x=read()
#define PLI pair<ll,int>
#define PII pair<int,int>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define pb(x) push_back(x)
#define ull unsigned long long
#define getc(c) scanf("%s",c+1)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define rep(i,x,y) for(RE int i=x;i<=y;++i)
#define fep(i,x,y) for(RE int i=x;i>=y;--i)
#define go(x) for(int i=link[x],y=a[i].y;i;y=a[i=a[i].next].y)
using namespace std;
const int N=100010;
int n,k,p1[N],p2[N],a[N],T;

inline int read()
{
	int x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}

int main()
{
	//freopen("1.in","r",stdin);
	get(T);
	while(T--)
	{
		get(n);get(k);
		rep(i,1,n) get(a[i]);
		if(n==1&&a[1]==k) {puts("yes");continue;}
		bool flag=false;
		rep(i,1,n)
		{
			if(a[i]==k)
			{
				int now=0;
				fep(j,i-1,1)
				{
					if(a[j]>=k) now++;
					else now--;
					if(now>=0) {flag=true;break;}
				}
				if(flag) break;
				now=0;
				rep(j,i+1,n)
				{
					if(a[j]>=k) now++;
					else now--;
					if(now>=0) {flag=true;break;}
				}
			}
			if(flag) break;
		}
		if(flag) puts("yes");
		else puts("no");
	}
	return 0;
}
//以吾之血,祭吾最后的亡魂


//不等,不问,不犹豫,不回头.
#include<bits/stdc++.h>
#define _ 0
#define db double
#define RE register
#define ll long long
#define P 1000000007
#define INF 1000000000
#define get(x) x=read()
#define PLI pair<ll,int>
#define PII pair<int,int>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define pb(x) push_back(x)
#define ull unsigned long long
#define getc(c) scanf("%s",c+1)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define rep(i,x,y) for(RE int i=x;i<=y;++i)
#define fep(i,x,y) for(RE int i=x;i>=y;--i)
#define go(x) for(int i=link[x],y=a[i].y;i;y=a[i=a[i].next].y)
using namespace std;
const int N=100010;
int n,k,p1[N],p2[N],a[N],T;//p1,p2的意义是从当前为向前最大连续子段和.

inline int read()
{
	int x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}

int main()
{
	//freopen("1.in","r",stdin);
	get(T);
	while(T--)
	{
		get(n);get(k);
		rep(i,1,n) get(a[i]);
		if(n==1)
		{
			if(a[1]==k) {puts("yes");continue;}
			else {puts("no");continue;}
		}
		int now=0;
		rep(i,1,n)
		{
			if(a[i]>k) now++;
			else now--;
			p1[i]=now;
			if(now<0) now=0;
		}
		now=0;
		fep(i,n,1)
		{
			if(a[i]>k) now++;
			else now--;
			p2[i]=now;
			if(now<0) now=0;
		}
		bool flag=false;
		rep(i,1,n)
		{
			if(a[i]==k)
			{
				if(i!=1&&p1[i-1]>=0) {flag=true;break;}
				if(i!=n&&p2[i+1]>=0) {flag=true;break;}
			}
		}
		if(flag) puts("yes");
		else puts("no");
	}
	return 0;
}
//以吾之血,祭吾最后的亡魂


//不等,不问,不犹豫,不回头.
#include<bits/stdc++.h>
#define _ 0
#define db double
#define RE register
#define ll long long
#define P 1000000007
#define INF 1000000000
#define get(x) x=read()
#define PLI pair<ll,int>
#define PII pair<int,int>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define pb(x) push_back(x)
#define ull unsigned long long
#define getc(c) scanf("%s",c+1)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define rep(i,x,y) for(RE int i=x;i<=y;++i)
#define fep(i,x,y) for(RE int i=x;i>=y;--i)
#define go(x) for(int i=link[x],y=a[i].y;i;y=a[i=a[i].next].y)
using namespace std;
const int N=100010;
int n,k,p1[N],p2[N],a[N],T;//p1,p2的意义是从当前为向前最大连续子段和.

inline int read()
{
	int x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}

int main()
{
	//freopen("1.in","r",stdin);
	get(T);
	while(T--)
	{
		get(n);get(k);
		rep(i,1,n) get(a[i]);
		if(n==1&&a[1]==k) {puts("yes");continue;}
		int now=0;
		rep(i,1,n)
		{
			if(a[i]>k) now++;
			else now--;
			p1[i]=now;
			if(now<0) now=0;
		}
		now=0;
		fep(i,n,1)
		{
			if(a[i]>k) now++;
			else now--;
			p2[i]=now;
			if(now<0) now=0;
		}
		bool flag=false;
		rep(i,1,n)
		{
			if(a[i]==k)
			{
				if(i!=1&&p1[i-1]>=0) {flag=true;break;}
				if(i!=n&&p2[i+1]>=0) {flag=true;break;}
			}
		}
		if(flag) puts("yes");
		else puts("no");
	}
	return 0;
}
//以吾之血,祭吾最后的亡魂


//不等,不问,不犹豫,不回头.
#include<bits/stdc++.h>
#define _ 0
#define db double
#define RE register
#define ll long long
#define P 1000000007
#define INF 1000000000
#define get(x) x=read()
#define PLI pair<ll,int>
#define PII pair<int,int>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define pb(x) push_back(x)
#define ull unsigned long long
#define getc(c) scanf("%s",c+1)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define rep(i,x,y) for(RE int i=x;i<=y;++i)
#define fep(i,x,y) for(RE int i=x;i>=y;--i)
#define go(x) for(int i=link[x],y=a[i].y;i;y=a[i=a[i].next].y)
using namespace std;
const int N=100010;
int n,k,p1[N],p2[N],a[N],T;

inline int read()
{
	int x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}

int main()
{
	//freopen("1.in","r",stdin);
	get(T);
	while(T--)
	{
		get(n);get(k);
		rep(i,1,n) get(a[i]);
		int now=0;
		rep(i,1,n)
		{
			if(a[i]>=k) now++;
			else now--;
			p1[i]=now;
			if(now<0) now=0;
		}
		now=0;
		fep(i,n,1)
		{
			if(a[i]>=k) now++;
			else now--;
			p2[i]=now;
			if(now<0) now=0;
		}
		if(n==1&&a[1]==k) {puts("yes");continue;}
		bool flag=false;
		rep(i,1,n)
		{
			if(a[i]==k)
			{
				if(i!=1&&p1[i-1]>=0) {flag=true;break;}
				if(i!=n&&p2[i+1]>=0) {flag=true;break;}
			}
		}
		if(flag) puts("yes");
		else puts("no");
	}
	return 0;
}
//以吾之血,祭吾最后的亡魂


//不等,不问,不犹豫,不回头.
//昨天cf的D题是真的自闭了....早早写完c题,一直干D.却只以失败告终....
//简单总结下,昨天的思路真的很接近正解了,不过有所缺漏...
//简单罗列下合法的情况...
//0 1   1 0    0 0   1 1 两个数的情况考虑了如果一个>=0的数旁边有同样>=0的数一定yes
//0 -1 1    0 -1 0   1 -1 1  三个数的话只用考虑旁边是-1的即可.
//四个数五个数呢,为什么不接着讨论下去了,不用了,因为我们会发现以上是最根本的情况.
//我们发现三个数只考虑周边有一个-1的情况,那四个数就该讨论有2个-1的情况,可是我们发现,-1已经占了数量的一半
//怎样都是不合法的.五个数还讨论两个-1的情况.咦,那不就变成了三个数有一个-1的情况了.所以以上的就是最初的判断条件.
#include<bits/stdc++.h>
#define _ 0
#define db double
#define RE register
#define ll long long
#define P 1000000007
#define INF 1000000000
#define get(x) x=read()
#define PLI pair<ll,int>
#define PII pair<int,int>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define pb(x) push_back(x)
#define ull unsigned long long
#define getc(c) scanf("%s",c+1)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define rep(i,x,y) for(RE int i=x;i<=y;++i)
#define fep(i,x,y) for(RE int i=x;i>=y;--i)
#define go(x) for(int i=link[x],y=a[i].y;i;y=a[i=a[i].next].y)
using namespace std;
const int N=100010;
int T,n,a[N],k;

inline int read()
{
	int x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}

inline void run()
{
	if(n==1&&a[1]==0) {puts("yes");return;}
	bool flag=false;
	rep(i,1,n) if(a[i]==0) flag=true;
	if(!flag) {puts("no");return;}
	rep(i,1,n)
	{
		if(a[i]>=0)
		{
			if(i!=n&&a[i+1]>=0) {puts("yes");return;}
			if(i<=n-2&&a[i+2]>=0) {puts("yes");return;}
		}
	}
	puts("no");
}

int main()
{
//	freopen("1.in","r",stdin);
	get(T);
	rep(i,1,T)
	{
		get(n);get(k);
		rep(i,1,n)
		{
			get(a[i]);
			if(a[i]>k) a[i]=1;
			else if(a[i]==k) a[i]=0;
			else if(a[i]<k) a[i]=-1;
		}
		run();
	}
	return (0^_^0);
}
//以吾之血,祭吾最后的亡魂


//
#include<bits/stdc++.h>
#define pb push_back
using namespace std;

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+10];
        bool f = 0;
        memset(arr,0,sizeof(arr));
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        bool flag = false;

        for(int i=1;i<=n-2;i++)
        {

         vector<int>v;
         v.pb(arr[i]),v.pb(arr[i+1]),v.pb(arr[i+2]);
         sort(v.begin(),v.end());
         if(v[0] == m||v[1]==m){
            flag = true; break;
         }

        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+2];
        bool f = 0;
        arr[0]=-1;
        arr[n+1]=-1;
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        bool flag = false;

        for(int i=1;i<=n-2;i++)
        {
           vector<int>v;
           v.push_back(arr[i]);
           v.push_back(arr[i+1]);
           v.push_back(arr[i+2]);

           sort(v.begin(),v.end());

           if(v[1] == m||v[0]==m){

            flag =true; break;
           }

        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+2];
        bool f = 0;
        arr[0]=-1;
        arr[n+1]=-1;
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        for(int i=1;i<=n;i++)
        {
             if(arr[i]>m && (arr[i-1] == m || arr[i+1] == m)){
                arr[i] = m;
             }
        }
        bool flag = false;

        for(int i=1;i<=n-2;i++)
        {

            if((arr[i]==m&&arr[i+1]==m)||(arr[i]==m && arr[i+2]==m)||(arr[i+1]==m && arr[i+2])){
                flag =true;break;
            }
        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+2];
        bool f = 0;
        arr[0]=-1;
        arr[n+1]=-1;
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        for(int i=1;i<=n;i++)
        {
             if(arr[i]>m && (arr[i-1] == m || arr[i+1] == m)){
                arr[i] = m;
             }
        }
        bool flag = false;

        for(int i=1;i<n;i++)
        {
           if((arr[i]==m&&arr[i+1]==m)||(arr[i]==m && arr[i+2]==m)||(arr[i+1]==m && arr[i+2]==m)){
                flag =true;break;
            }
        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+2];
        bool f = 0;
        arr[0]=-1;
        arr[n+1]=-1;
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        for(int i=1;i<=n;i++)
        {
             if(arr[i]>m && (arr[i-1] == m || arr[i+1] == m)){
                arr[i] = m;
             }
        }
        bool flag = false;

        for(int i=1;i<n;i++)
        {
           if((arr[i]==m&&arr[i+1]==m)||(arr[i]==m && arr[i+2]==m)||(arr[i+1]==m && arr[i+2])){
                flag =true;break;
            }
        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+2];
        bool f = 0;
        arr[0]=-1;
        arr[n+1]=-1;
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        for(int i=1;i<=n;i++)
        {
             if(arr[i]>m && (arr[i-1] == m || arr[i+1] == m)){
                arr[i] = m;
             }
        }
        bool flag = false;

        for(int i=1;i<n;i++)
        {
            if(arr[i] == m && arr[i+1] == m){
                flag =true;break;
            }
        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n];
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        for(int i=0;i<n;i++)
        {
            if(i==0){
                if(arr[i+1] == m && arr[i]>arr[i])arr[i]=m;
            }
            else if(i==n-1){
                if(arr[i-1] == m && arr[i]>arr[i-1])arr[i]=m;
            }
            else{
                if(arr[i]>m && (arr[i+1] == m||arr[i-1]==m))arr[i]=m;
            }
        }
        bool flag=true;
        int cnt=0;
        for(int i=0;i<n;i++)
        {
            if(arr[i]!=m){
              if(cnt>=2){cnt++;arr[i]=m;}
              else{
                int j=i;
                while(arr[j]!=m && j<n){arr[j]=m,j++;}
                int k=j;
                while(arr[k]==m && k<n)k++;
                int low = j-i;
                int tct = cnt + k-j;
                if(low < tct){cnt+=low;}
                else {flag=false;break;}

              }

            }
        }
        for(int i=0;i<n;i++){
            if(arr[i]!=m)flag=false;
        }
        if(!flag)cout<<"no\n";
        else{
            cout<<"yes\n";
        }
    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+10];
        bool f = 0;
        memset(arr,0,sizeof(arr));
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        bool flag = false;

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

           if((arr[i] >= m && arr[i+2]>=m)||(arr[i]>=m &&arr[i+1]>=m)){

            flag =true; break;
           }

        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n];
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        for(int i=0;i<n;i++)
        {
            if(i==0){
                if(arr[i+1] == m && arr[i]>arr[i+1])arr[i]=m;
            }
            else if(i==n-1){
                if(arr[i-1] == m && arr[i]>arr[i-1])arr[i]=m;
            }
            else{
                if(arr[i]>m && (arr[i+1] == m||arr[i-1]==m))arr[i]=m;
            }
        }
        bool flag=true;
        int cnt=0;
        for(int i=0;i<n;i++)
        {
            if(arr[i]!=m){
              if(cnt>=2){cnt++;arr[i]=m;}
              else{
                int j=i;
                while(j<n && arr[j]!=m){arr[j]=m,j++;}
                int k=j;
                while( k<n && arr[k]==m)k++;
                int low = j-i;
                int tct = cnt + k-j;
                if(low < tct){cnt+=low;}
                else {flag=false;break;}

              }

            }
        }
        for(int i=0;i<n;i++){
            if(arr[i]!=m)flag=false;
        }
        if(!flag)cout<<"no\n";
        else{
            cout<<"yes\n";
        }
    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+2];
        bool f = 0;
        arr[0]=-1;
        arr[n+1]=-1;
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        for(int i=1;i<=n;i++)
        {
            if(arr[i] == m)
            {
                if(arr[i-1]>m)arr[i-1]=m;
                if(arr[i+1]>m)arr[i+1]=m;
            }
        }
        bool flag = false;

        for(int i=1;i<n;i++)
        {
           if((arr[i]==m&&arr[i+1]==m)||(arr[i]==m && arr[i+2]==m)||(arr[i+1]==m && arr[i+2]==m)){
                flag =true;break;
            }
        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


//
#include<bits/stdc++.h>
#define pb push_back
using namespace std;

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+10];
        bool f = 0;
        memset(arr,0,sizeof(arr));
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        bool flag = false;

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

         vector<int>v;
         v.pb(arr[i]),v.pb(arr[i+1]),v.pb(arr[i+2]);
         sort(v.begin(),v.end());
         if(v[0] == m||v[1]==m){
            flag = true; break;
         }

        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+10];
        bool f = 0;
        memset(arr,0,sizeof(arr));
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        bool flag = false;

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

           if((arr[i] >= m && arr[i+2]>=m)||(arr[i]>=m &&arr[i+1]>=m)){

            flag =true; break;
           }

        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+10];
        bool f = 0;
        memset(arr,0,sizeof(arr));
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        bool flag = false;

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

           if(arr[i] == m){
            if(arr[i+1]>=m||arr[i+2]>=m)  {flag =true; break;}

           }

        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+2];
        bool f = 0;
        arr[0]=-1;
        arr[n+1]=-1;
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        for(int i=1;i<=n;i++)
        {
             if(arr[i]>m && (arr[i-1] == m || arr[i+1] == m)){
                arr[i] = m;
             }
        }
        bool flag = false;

        for(int i=1;i<=n-2;i++)
        {
            int x = arr[i],y =arr[i+1],z = arr[i+2];
            if(x>y)swap(x,y);
            if(x>z)swap(x,z);
            if(y>z)swap(y,z);
            if((x==m&&y==m)||(y==m && z==m)){
                flag =true;break;
            }
        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n+2];
        bool f = 0;
        arr[0]=-1;
        arr[n+1]=-1;
        for(int i=1;i<=n;i++)
        {
            cin>>arr[i];
            if(arr[i] == m)f=1;
        }

        if(f == 0){cout<<"no\n";continue;}
        if(n ==1 && f==1){cout<<"yes\n";continue;}
        bool flag = false;

        for(int i=1;i<=n-2;i++)
        {
           vector<int>v;
           v.push_back(arr[i]);
           v.push_back(arr[i+1]);
           v.push_back(arr[i+2]);

           sort(v.begin(),v.end());

           if(v[1] == m){

            flag =true; break;
           }

        }
        if(flag)cout<<"yes\n";
        else cout<<"no\n";

    }

}


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

int main()
{

    int t; cin>>t;
    while(t--)
    {
        int n,m; cin>>n>>m;
        int arr[n];
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        for(int i=0;i<n;i++)
        {
            if(i==0){
                if(arr[i+1] == m && arr[i]>arr[i])arr[i]=m;
            }
            else if(i==n-1){
                if(arr[i-1] == m && arr[i]>arr[i-1])arr[i]=m;
            }
            else{
                if(arr[i]>m && (arr[i+1] == m||arr[i-1]==m))arr[i]=m;
            }
        }
        bool flag=true;
        int cnt=0;
        for(int i=0;i<n;i++)
        {
            if(arr[i]!=m){
              if(cnt>=2){cnt++;arr[i]=m;}
              else{
                int j=i;
                while(j<n && arr[j]!=m){arr[j]=m,j++;}
                int k=j;
                while( k<n && arr[k]==m)k++;
                int low = j-i;
                int tct = cnt + k-j;
                if(low < tct){cnt+=low;}
                else {flag=false;break;}

              }

            }
        }
        for(int i=0;i<n;i++){
            if(arr[i]!=m)flag=false;
        }
        if(!flag)cout<<"no\n";
        else{
            cout<<"yes\n";
        }
    }

}


#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
inline int read()
{
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
int a[200001],qz[200001],lmin[200001],rmax[200001];
signed main()
{
	int t,n,k;
	bool flag;
	t=read();
	for(int greg=1;greg<=t;greg++)
	{
	n=read();
	k=read();
	for(int i=1;i<=n;i++)a[i]=read();
	flag=false;
	if(n==1)
	{
		if(a[1]==k)printf("yes\n");
		else printf("no\n");
		continue;
	}
	lmin[0]=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=k)qz[i]=qz[i-1]+1;
		else qz[i]=qz[i-1]-1;
		lmin[i]=min(lmin[i-1],qz[i]);
	}
	rmax[n+1]=-1000000000;
	for(int i=n;i>=1;i--)rmax[i]=max(qz[i],rmax[i+1]);
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=k)continue;
		if((i>=2&&qz[i]-lmin[i-2]>0)||rmax[i+1]-qz[i-1]>0)
		{
			printf("yes\n");
			flag=true;
			break;
		}
	}
	if(flag==true)continue;
	printf("no\n");
    }
	return 0;
}


#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
inline int read()
{
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
int a[200001],qz[200001],lmin[200001],rmax[200001];
signed main()
{
	int t,n,k;
	bool flag;
	t=read();
	for(int greg=1;greg<=t;greg++)
	{
	n=read();
	k=read();
	for(int i=1;i<=n;i++)a[i]=read();
	flag=false;
	if(n==1)
	{
		if(a[1]==k)printf("yes\n");
		else printf("no\n");
		continue;
	}
	lmin[0]=1000000000;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=k)qz[i]=qz[i-1]+1;
		else qz[i]=qz[i-1]-1;
		lmin[i]=min(lmin[i-1],qz[i]);
	}
	rmax[n+1]=-1000000000;
	for(int i=n;i>=1;i--)rmax[i]=max(qz[i],rmax[i+1]);
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=k)continue;
		if(qz[i-1]-lmin[i-1]>0||rmax[i]-qz[i]>0)
		{
			printf("yes\n");
			flag=true;
			break;
		}
	}
	if(flag==true)continue;
	printf("no\n");
    }
	return 0;
}


#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
inline int read()
{
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
int a[500001],qz[500001],lmin[500001],rmax[500001];
signed main()
{
	int t,n,k;
	bool flag;
	t=read();
	for(int greg=1;greg<=t;greg++)
	{
	n=read();
	k=read();
	for(int i=1;i<=n;i++)a[i]=read();
	flag=false;
	if(n==1)
	{
		if(a[1]==k)printf("yes\n");
		else printf("no\n");
		continue;
	}
	lmin[0]=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=k)qz[i]=qz[i-1]+1;
		else qz[i]=qz[i-1]-1;
		lmin[i]=min(lmin[i-1],qz[i]);
	}
	rmax[n+1]=-1000000000;
	rmax[n]=qz[n];
	for(int i=n-1;i>=1;i--)rmax[i]=max(qz[i],rmax[i+1]);
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=k)continue;
		if((i>=2&&qz[i]-lmin[i-2]>0)||rmax[i+1]-qz[i-1]>0)
		{
			printf("yes\n");
			flag=true;
			break;
		}
	}
	if(flag==true)continue;
	printf("no\n");
    }
	return 0;
}


#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
inline int read()
{
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
int a[500001],qz[500001],lmin[500001],rmax[500001];
signed main()
{
	int t,n,k;
	bool flag;
	t=read();
	for(int greg=1;greg<=t;greg++)
	{
	n=read();
	k=read();
	for(int i=1;i<=n;i++)a[i]=read();
	flag=false;
	if(n==1)
	{
		if(a[1]==k)printf("yes\n");
		else printf("no\n");
		continue;
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]==k)
		{
			flag=true;
			break;
		}
	}
	if(flag==false)
	{
		printf("no\n");
		continue;
	}
	flag=false;
	for(int i=1;i<=n-1;i++)
	{
		if(a[i]>=k&&a[i+1]>=k)
		{
			flag=true;
			break;
		}
	}
	if(flag==true)
	{
		printf("yes\n");
		continue;
	}
	for(int i=1;i<=n-2;i++)
	{
		if(a[i]>=k&&a[i+2]>=k)
		{
				flag=true;
				break;
		}
    }
    if(flag==true)
    {
    	printf("yes\n");
    	continue;
	}
	printf("no\n");
	}
	return 0;
}


v#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
inline int read()
{
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
int a[200001];
signed main()
{
	int t,n,k;
	bool flag;
	t=read();
	for(int greg=1;greg<=t;greg++)
	{
	n=read();
	k=read();
	for(int i=1;i<=n;i++)a[i]=read();
	flag=false;
	if(n==1)
	{
		if(a[1]==k)printf("yes\n");
		else printf("no\n");
		continue;
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=k)continue;
		if(a[i]<=a[i-1]||a[i]<=a[i+1])
		{
			printf("yes\n");
			flag=true;
			break;
		}
	}
	if(flag==true)continue;
	printf("no\n");
    }
	return 0;
}


#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
inline int read()
{
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
int a[500001],qz[500001],lmin[500001],rmax[500001];
signed main()
{
	int t,n,k;
	bool flag;
	t=read();
	for(int greg=1;greg<=t;greg++)
	{
	n=read();
	k=read();
	for(int i=1;i<=n;i++)a[i]=read();
	flag=false;
	if(n==1)
	{
		if(a[1]==k)printf("yes\n");
		else printf("no\n");
		continue;
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]==k)
		{
			flag=true;
			break;
		}
	}
	if(flag==false)
	{
		printf("no\n");
		continue;
	}
	flag=false;
	for(int i=1;i<=n-1;i++)
	{
		if(a[i]>=k&&a[i+1]>=k)
		{
			flag=true;
			break;
		}
	}
	if(flag==true)
	{
		printf("yes\n");
		continue;
	}
	for(int i=1;i<=n-2;i++)
	{
		if(a[i]>=k&&a[i+2]>=k)
		{
			if(a[i]==k||a[i+1]==k||a[i+2]==k)
			{
				flag=true;
				break;
			}
		}
    }
    if(flag==true)
    {
    	printf("yes\n");
    	continue;
	}
	printf("no\n");
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
inline int read()
{
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
int a[200001];
signed main()
{
	int t,n,k;
	bool flag;
	t=read();
	for(int greg=1;greg<=t;greg++)
	{
	n=read();
	k=read();
	for(int i=1;i<=n;i++)a[i]=read();
	flag=false;
	if(n==1)
	{
		if(a[1]==k)printf("yes\n");
		else printf("no\n");
		continue;
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=k)continue;
		if(a[i]<=a[i-1]||a[i]<=a[i+1])
		{
			printf("yes\n");
			flag=true;
			break;
		}
	}
	if(flag==true)continue;
	printf("no\n");
    }
	return 0;
}


#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
inline int read()
{
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
int a[200001],qz[200001],lmin[200001],rmax[200001];
signed main()
{
	int t,n,k;
	bool flag;
	t=read();
	for(int greg=1;greg<=t;greg++)
	{
	n=read();
	k=read();
	for(int i=1;i<=n;i++)a[i]=read();
	flag=false;
	if(n==1)
	{
		if(a[1]==k)printf("yes\n");
		else printf("no\n");
		continue;
	}
	lmin[0]=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=k)qz[i]=qz[i-1]+1;
		else qz[i]=qz[i-1]-1;
		lmin[i]=min(lmin[i-1],qz[i]);
	}
	rmax[n+1]=-1000000000;
	for(int i=n;i>=1;i--)rmax[i]=max(qz[i],rmax[i+1]);
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=k)continue;
		if(qz[i-1]-lmin[i-1]>0||rmax[i]-qz[i]>0)
		{
			printf("yes\n");
			flag=true;
			break;
		}
	}
	if(flag==true)continue;
	printf("no\n");
    }
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <set>
#include <unordered_map>
#include <map>
#include <queue>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <random>

//#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pld pair <ld, ld>
#define pii pair <ll, ll>

using namespace std;
//using namespace __gnu_pbds;

/*typedef
tree<
  pii,
  null_type,
  less<pii>,
  rb_tree_tag,
  // This policy updates nodes' metadata for order statistics.
  tree_order_statistics_node_update>
set_t;*/

const ll INF = 7 + 1e9 * 2;
const int N = 1e6 + 100;
const int M = 1e5 + 10;
const double EPS = 1 / 1e10;
const ll HESH = 73;
const ll MAX_H = 1e5;

ll a[N];

int main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int q;
    cin >> q;
    while(q--)
    {
        int n, k, t = 0;
        cin >> n >> k;
        for(int i = 0; i < n; i++){
            cin >> a[i];
            if(a[i] > k)
                a[i] = 2;
            else
            if(a[i] == k)
                a[i] = 1, t++;
            else
            if(a[i] < k)
                a[i] = 0;
        }

        if(!t){
            cout << "NO\n";
            continue;
        }
        t = 0;
        vector <int> v;

        for(int i = 0; i < n - 1; i++)
        {
            v.clear();
            for(int j = i; j < n && j <= i + 2; j++)
                v.pb(a[j]);
            sort(v.begin(), v.end());
            if((v[1] == 1 && v.size() != 2) || v[0] == 1)
                t = 1;//, cout << v[0] << " " << v[1] << " " << v.size() << "\n";
            //cout << v[0] << " " << v[1] << " " << v[2] << "\n";
        }
        if(t || n == 1)
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <set>
#include <unordered_map>
#include <map>
#include <queue>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <random>

//#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pld pair <ld, ld>
#define pii pair <ll, ll>

using namespace std;
//using namespace __gnu_pbds;

/*typedef
tree<
  pii,
  null_type,
  less<pii>,
  rb_tree_tag,
  // This policy updates nodes' metadata for order statistics.
  tree_order_statistics_node_update>
set_t;*/

const ll INF = 7 + 1e9 * 2;
const int N = 1e6 + 100;
const int M = 1e5 + 10;
const double EPS = 1 / 1e10;
const ll HESH = 73;
const ll MAX_H = 1e5;

ll a[N];

int main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int q;
    cin >> q;
    while(q--)
    {
        int n, k, t = 0;
        cin >> n >> k;
        for(int i = 0; i < n; i++){
            cin >> a[i];
            if(a[i] > k)
                a[i] = 2;
            else
            if(a[i] == k)
                a[i] = 1, t++;
            else
            if(a[i] < k)
                a[i] = 0;
        }

        if(!t){
            cout << "NO\n";
            continue;
        }
        t = 0;
        vector <int> v;

        for(int i = 0; i < n - 1; i++)
        {
            v.clear();
            for(int j = i; j < n && j <= i + 2; j++)
                v.pb(a[j]);
            sort(v.begin(), v.end());
            if((v[1] == 1 && v.size() == 3) || (v[0] == 1 && v.size() == 2))
                t = 1;//, cout << v[0] << " " << v[1] << " " << i << "\n";
            //cout << v[0] << " " << v[1] << " " << v[2] << "\n";
        }
        if(t || n == 1)
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <set>
#include <unordered_map>
#include <map>
#include <queue>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <random>

//#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pld pair <ld, ld>
#define pii pair <ll, ll>

using namespace std;
//using namespace __gnu_pbds;

/*typedef
tree<
  pii,
  null_type,
  less<pii>,
  rb_tree_tag,
  // This policy updates nodes' metadata for order statistics.
  tree_order_statistics_node_update>
set_t;*/

const ll INF = 7 + 1e9 * 2;
const int N = 1e6 + 100;
const int M = 1e5 + 10;
const double EPS = 1 / 1e10;
const ll HESH = 73;
const ll MAX_H = 1e5;

ll a[N];

int main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int q;
    cin >> q;
    while(q--)
    {
        int n, k, t = 0;
        cin >> n >> k;
        for(int i = 0; i < n; i++){
            cin >> a[i];
            if(a[i] > k)
                a[i] = 2;
            else
            if(a[i] == k)
                a[i] = 1, t++;
            else
            if(a[i] < k)
                a[i] = 0;
        }

        if(!t){
            cout << "NO\n";
            continue;
        }
        t = 0;
        vector <int> v;

        for(int i = 0; i < n - 1; i++)
        {
            v.clear();
            for(int j = i + 1; j < n && j <= i + 2; j++)
                if(a[i] && a[j])
                    t = 1;//, cout << v[0] << " " << v[1] << " " << v.size() << "\n";
            //cout << v[0] << " " << v[1] << " " << v[2] << "\n";
        }
        if(t || n == 1)
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <iomanip>
#include <set>
#include <unordered_map>
#include <map>
#include <queue>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <random>

//#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define ld long double
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pld pair <ld, ld>
#define pii pair <ll, ll>

using namespace std;
//using namespace __gnu_pbds;

/*typedef
tree<
  pii,
  null_type,
  less<pii>,
  rb_tree_tag,
  // This policy updates nodes' metadata for order statistics.
  tree_order_statistics_node_update>
set_t;*/

const ll INF = 7 + 1e9 * 2;
const int N = 1e6 + 100;
const int M = 1e5 + 10;
const double EPS = 1 / 1e10;
const ll HESH = 73;
const ll MAX_H = 1e5;

ll a[N];

int main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int q;
    cin >> q;
    while(q--)
    {
        int n, k, t = 0;
        cin >> n >> k;
        for(int i = 0; i < n; i++){
            cin >> a[i];
            if(a[i] > k)
                a[i] = 2;
            else
            if(a[i] == k)
                a[i] = 1, t++;
            else
            if(a[i] < k)
                a[i] = 0;
        }

        if(!t){
            cout << "NO\n";
            continue;
        }
        t = 0;
        vector <int> v;

        for(int i = 0; i < n - 1; i++)
        {
            v.clear();
            for(int j = i; j < n && j <= i + 2; j++)
                v.pb(a[j]);
            sort(v.begin(), v.end());
            if(v[(v.size() + 1) / 2 - 1] == 1)
                t = 1;//, cout << v[0] << " " << v[1] << " " << i << "\n";
            //cout << v[0] << " " << v[1] << " " << v[2] << "\n";
        }
        if(t || n == 1)
            cout << "YES\n";
        else
            cout << "NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define cs const
#define pb push_back
typedef long long ll;
cs int N = 1e5 + 50;
cs int INF = 1e9 + 7;
int T, n, k, a[N];
void Main(){
	scanf("%d%d",&n,&k);
	static int bin[N];
	for(int i=1; i<=n+n; i++) bin[i]=0;
	static int pr[N];
	bool ok = false;
	for(int i=1,sm=0; i<=n; i++){
		scanf("%d",&a[i]); pr[i]=pr[i-1]+(a[i]==k);
		if(a[i]<k) sm-=1; if(a[i]>k) sm+=1;
		if(bin[sm+n]){
			if(i-bin[sm+n]>1 && pr[i]-pr[bin[sm+n]]>0) ok=true;
		} else bin[sm+n]=i;

		if(a[i]==k&&n==1) ok=true;
		if(a[i]==k && a[i-1]==k) ok=true;
		if(a[i-1]==k && a[i]>=k) ok=true;
		if(a[i]==k && a[i-1]>=k) ok=true;
	} if(ok) return puts("yes"),void();
	return puts("no"),void();
}
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d",&T); while(T--) Main(); return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define cs const
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> pi;
cs int N = 2e5 + 50;
cs int INF = 1e9 + 7;
int T, n, k, a[N];
void Main(){
	scanf("%d%d",&n,&k);
	int ct=0; bool ok=false, flg=false;
	for(int i=1; i<=n; i++){
		scanf("%d",&a[i]); ct+=a[i]==k;
		if(a[i]==k&&n==1) ok=true;
		if(a[i]>=k&&a[i-1]>=k) flg=true;
		if(a[i]>=k&&a[i-2]>=k) flg=true;
		if(a[i]==k && a[i-1]==k) ok=true;
		if(a[i-1]==k && a[i]>=k) ok=true;
		if(a[i]==k && a[i-1]>=k) ok=true;
	} if(ok) return puts("yes"),void();
	if(flg&&ct) puts("yes"); else puts("no");
}
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d",&T); while(T--) Main(); return 0;
}


/**                                                    ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
/**
░▄▀▄▀▀▀▀▄▀▄░░░░░░░░░
░█░░░░░░░░▀▄░░░░░░▄░
█░░▀░░▀░░░░░▀▄▄░░█░█
█░▄░█▀░▄░░░░░░░▀▀░░█
█░░▀▀▀▀░░░░░░░░░░░░█
█░░░░░░░░░░░░░░░░░░█
█░░░░░░░░░░░░░░░░░░█
░█░░▄▄░░▄▄▄▄░░▄▄░░█░
░█░▄▀█░▄▀░░█░▄▀█░▄▀░
░░▀░░░▀░░░░░▀░░░▀░░░
*/
#include <bits/stdc++.h>
#define br  break
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define un   unsigned
#define do   double
#define cr   char
#define st   string
#define sc   scanf
#define pr   printf
#define mk   make_pair
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define N    1000256
#define M    1000000007
#define I    1000000000000000000
#define en                 printf( "\n" )
#define sqr( a )           ( ( a ) * ( a ) )
#define cbr( a )           ( ( a ) * ( a ) * ( a ))
#define all( c )           ( c ).begin(), ( c ).end()
#define rev( c )           reverse( all( c ) )
#define srt( c )           sort( all( c ) )
#define ifs( s )           ifstream cin( s )
#define ofs( s )           ofstream cout( s )
#define mxx( x, y, z )     max( x, max( y, z ) )
#define mnn( x, y, z )     min( x, min( y, z ) )
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
#define fin( s )           freopen( s, "r", stdin )
#define fout( s )          freopen( s, "w", stdout )
#define lcm( a, b )        ( ( a * b ) / gcd( a, b ) )
#define pif( x, y )        sqrt( sqr( x ) + sqr( y ) )
#define dist( x, y, z, c ) sqrt( sqr( x - z ) + sqr( y - c ) )
#define speed              ios_base::sync_with_stdio( 0 ), cin.tie( 0 ), cout.tie( 0 )
#define toprun             ios_base::sync_with_stdio( 0 ), cin.tie( 0 )
using namespace std;
ll tests;
ll n, a[ N ], p[ N ], ans;
void solve()
{
	cin >> n;
	for( int i = 1; i <= n; i ++ )
    {
        cin >> a[ i ];
        p[ i ] = a[ i ] + p[ i - 1 ];
    }
    ans = sqr( a[ 2 ] ) + 1;
    for( int i = 1; i < n; i ++ )
    {
        if( sqr( i ) >= ans )break;
        for( int j = 1; j <= n - i; j ++ )
            ans = min( ans, sqr( i ) + sqr( p[ j - i ] - p[ j ] ) );
    }
    cout << ans;
}
int main()
{
    /*fin( "input.txt" );
	fout( "output.txt" );*/
    speed;
    /*cin >> tests;
    while( tests -- )*/
        solve();
}


/**                                                    ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
/**
░▄▀▄▀▀▀▀▄▀▄░░░░░░░░░
░█░░░░░░░░▀▄░░░░░░▄░
█░░▀░░▀░░░░░▀▄▄░░█░█
█░▄░█▀░▄░░░░░░░▀▀░░█
█░░▀▀▀▀░░░░░░░░░░░░█
█░░░░░░░░░░░░░░░░░░█
█░░░░░░░░░░░░░░░░░░█
░█░░▄▄░░▄▄▄▄░░▄▄░░█░
░█░▄▀█░▄▀░░█░▄▀█░▄▀░
░░▀░░░▀░░░░░▀░░░▀░░░
*/
#include <bits/stdc++.h>
#define br  break
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define un   unsigned
#define do   double
#define cr   char
#define st   string
#define sc   scanf
#define pr   printf
#define mk   make_pair
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define N    1000256
#define M    1000000007
#define I    1000000000000000000
#define en                 printf( "\n" )
#define sqr( a )           ( ( a ) * ( a ) )
#define cbr( a )           ( ( a ) * ( a ) * ( a ))
#define all( c )           ( c ).begin(), ( c ).end()
#define rev( c )           reverse( all( c ) )
#define srt( c )           sort( all( c ) )
#define ifs( s )           ifstream cin( s )
#define ofs( s )           ofstream cout( s )
#define mxx( x, y, z )     max( x, max( y, z ) )
#define mnn( x, y, z )     min( x, min( y, z ) )
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
#define fin( s )           freopen( s, "r", stdin )
#define fout( s )          freopen( s, "w", stdout )
#define lcm( a, b )        ( ( a * b ) / gcd( a, b ) )
#define pif( x, y )        sqrt( sqr( x ) + sqr( y ) )
#define dist( x, y, z, c ) sqrt( sqr( x - z ) + sqr( y - c ) )
#define speed              ios_base::sync_with_stdio( 0 ), cin.tie( 0 ), cout.tie( 0 )
#define toprun             ios_base::sync_with_stdio( 0 ), cin.tie( 0 )
using namespace std;
ll tests;
ll n, a[ N ], p[ N ], ans;
void solve()
{
	cin >> n;
	for( int i = 1; i <= n; i ++ )
    {
        cin >> a[ i ];
        p[ i ] = a[ i ] + p[ i - 1 ];
    }
    ans = sqr( a[ 2 ] ) + 1;
    for( int i = 1; i < n; i ++ )
    {
        if( sqr( i ) >= ans )break;
        for( int j = 1; j <= n - i; j ++ )
            ans = min( ans, sqr( i ) + sqr( p[ j + i ] - p[ j ] ) );
    }
    cout << ans;
}
int main()
{
    /*fin( "input.txt" );
	fout( "output.txt" );*/
    speed;
    /*cin >> tests;
    while( tests -- )*/
        solve();
}


/**                                                    ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
/**
░▄▀▄▀▀▀▀▄▀▄░░░░░░░░░
░█░░░░░░░░▀▄░░░░░░▄░
█░░▀░░▀░░░░░▀▄▄░░█░█
█░▄░█▀░▄░░░░░░░▀▀░░█
█░░▀▀▀▀░░░░░░░░░░░░█
█░░░░░░░░░░░░░░░░░░█
█░░░░░░░░░░░░░░░░░░█
░█░░▄▄░░▄▄▄▄░░▄▄░░█░
░█░▄▀█░▄▀░░█░▄▀█░▄▀░
░░▀░░░▀░░░░░▀░░░▀░░░
*/
#include <bits/stdc++.h>
#define br  break
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define un   unsigned
#define do   double
#define cr   char
#define st   string
#define sc   scanf
#define pr   printf
#define mk   make_pair
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define N    1000256
#define M    1000000007
#define I    1000000000000000000
#define en                 printf( "\n" )
#define sqr( a )           ( ( a ) * ( a ) )
#define cbr( a )           ( ( a ) * ( a ) * ( a ))
#define all( c )           ( c ).begin(), ( c ).end()
#define rev( c )           reverse( all( c ) )
#define srt( c )           sort( all( c ) )
#define ifs( s )           ifstream cin( s )
#define ofs( s )           ofstream cout( s )
#define mxx( x, y, z )     max( x, max( y, z ) )
#define mnn( x, y, z )     min( x, min( y, z ) )
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
#define fin( s )           freopen( s, "r", stdin )
#define fout( s )          freopen( s, "w", stdout )
#define lcm( a, b )        ( ( a * b ) / gcd( a, b ) )
#define pif( x, y )        sqrt( sqr( x ) + sqr( y ) )
#define dist( x, y, z, c ) sqrt( sqr( x - z ) + sqr( y - c ) )
#define speed              ios_base::sync_with_stdio( 0 ), cin.tie( 0 ), cout.tie( 0 )
#define toprun             ios_base::sync_with_stdio( 0 ), cin.tie( 0 )
using namespace std;
ll tests;
ll n, a[ N ], p[ N ], ans;
void solve()
{
	cin >> n;
	for( int i = 1; i <= n; i ++ )
    {
        cin >> a[ i ];
        p[ i ] = a[ i ] + p[ i - 1 ];
    }
    ans = sqr( a[ 2 ] ) + 1;
    for( int i = 1; i <= n; i ++ )
    {
        if( sqr( i ) >= ans )break;
        for( int j = i + 1; j <= n - i; j ++ )
            ans = min( ans, sqr( i ) + sqr( p[ j - i ] - p[ j ] ) );
    }
    cout << ans;
}
int main()
{
    /*fin( "input.txt" );
	fout( "output.txt" );*/
    speed;
    /*cin >> tests;
    while( tests -- )*/
        solve();
}


/**                                                    ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
/**
░▄▀▄▀▀▀▀▄▀▄░░░░░░░░░
░█░░░░░░░░▀▄░░░░░░▄░
█░░▀░░▀░░░░░▀▄▄░░█░█
█░▄░█▀░▄░░░░░░░▀▀░░█
█░░▀▀▀▀░░░░░░░░░░░░█
█░░░░░░░░░░░░░░░░░░█
█░░░░░░░░░░░░░░░░░░█
░█░░▄▄░░▄▄▄▄░░▄▄░░█░
░█░▄▀█░▄▀░░█░▄▀█░▄▀░
░░▀░░░▀░░░░░▀░░░▀░░░
*/
#include <bits/stdc++.h>
#define br  break
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define un   unsigned
#define do   double
#define cr   char
#define st   string
#define sc   scanf
#define pr   printf
#define mk   make_pair
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define N    1000256
#define M    1000000007
#define I    1000000000000000000
#define en                 printf( "\n" )
#define sqr( a )           ( ( a ) * ( a ) )
#define cbr( a )           ( ( a ) * ( a ) * ( a ))
#define all( c )           ( c ).begin(), ( c ).end()
#define rev( c )           reverse( all( c ) )
#define srt( c )           sort( all( c ) )
#define ifs( s )           ifstream cin( s )
#define ofs( s )           ofstream cout( s )
#define mxx( x, y, z )     max( x, max( y, z ) )
#define mnn( x, y, z )     min( x, min( y, z ) )
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
#define fin( s )           freopen( s, "r", stdin )
#define fout( s )          freopen( s, "w", stdout )
#define lcm( a, b )        ( ( a * b ) / gcd( a, b ) )
#define pif( x, y )        sqrt( sqr( x ) + sqr( y ) )
#define dist( x, y, z, c ) sqrt( sqr( x - z ) + sqr( y - c ) )
#define speed              ios_base::sync_with_stdio( 0 ), cin.tie( 0 ), cout.tie( 0 )
#define toprun             ios_base::sync_with_stdio( 0 ), cin.tie( 0 )
using namespace std;
ll tests;
ll n, a[ N ], p[ N ], ans;
void solve()
{
	cin >> n;
	for( int i = 1; i <= n; i ++ )
    {
        cin >> a[ i ];
        p[ i ] = a[ i ] + p[ i - 1 ];
    }
    ans = sqr( a[ 2 ] ) + 1;
    for( int i = 1; i < n; i ++ )
    {
        if( sqr( i ) >= ans )break;
        for( int j = i + 1; j <= n - i; j ++ )
            ans = min( ans, sqr( i ) + sqr( p[ j - i ] - p[ j ] ) );
    }
    cout << ans;
}
int main()
{
    /*fin( "input.txt" );
	fout( "output.txt" );*/
    speed;
    /*cin >> tests;
    while( tests -- )*/
        solve();
}


#include <bits/stdc++.h>
using namespace std;
typedef double db;
#define fir first
#define sec second
const db PI = atan2(0, -1);
const db EPS = 1e-8;
int sgn(db x) {
	return x < -EPS ? -1 : EPS < x;
}

struct Poi {
	db x, y;
	Poi() {}
	Poi(db x, db y):x(x), y(y) {}
	db cross(const Poi&rhs) {
		return x * rhs.y - y * rhs.x;
	}
	db dot(const Poi&rhs) {
		return x * rhs.x + y * rhs.y;
	}
	db len2() {
		return dot(*this);
	}
	Poi operator + (const Poi&rhs) {
		return Poi(x + rhs.x, y + rhs.y);
	}
	Poi operator - (const Poi&rhs) {
		return Poi(x - rhs.x, y - rhs.y);
	}
	Poi operator * (db p) {
		return Poi(x * p, y * p);
	}
	Poi operator / (db p) {
		return Poi(x / p, y / p);
	}
	bool operator == (const Poi&rhs) {
		return sgn(x - rhs.x) == 0 && sgn(y - rhs.y) == 0;
	}
	Poi norm() {
		return Poi(-y, x);
	}
	db ang() {
		db a = atan2(y, x);
		if (a < 0) a += PI * 2;
		return a;
	}
};

db len2(Poi a) {
	return a.len2();
}

struct Cir:Poi {
	db r;
	Cir() {}
	Cir(db _x, db _y, db r):r(r) {
		x = _x, y = _y;
	}
	Poi getPoi(db ang) {
		return Poi(x + cos(ang) * r, y + sin(ang) * r);
	}
};

int getTangents(Cir A, Cir B, Poi*a, Poi*b) {
	int cnt = 0;
	if (A.r < B.r) { swap(A, B), swap(a, b); }
	db d2 = (A - B).len2();
	db rdiff = A.r - B.r;
	db rsum = A.r + B.r;
	if (d2 < rdiff * rdiff) return 0;

	db base = (B - A).ang();
	if (sgn(d2) == 0 && sgn(A.r - B.r) == 0) return -1;

	if (sgn(d2 - rdiff * rdiff) == 0) {
		a[cnt] = A.getPoi(base); b[cnt] = B.getPoi(base); ++cnt;
		return 1;
	}

	db ang = acos((A.r - B.r) / sqrt(d2));
	a[cnt] = A.getPoi(base + ang); b[cnt] = B.getPoi(base + ang); ++cnt;
	a[cnt] = A.getPoi(base - ang); b[cnt] = B.getPoi(base - ang); ++cnt;
	if (sgn(d2 - rsum * rsum) == 0) {
		a[cnt] = A.getPoi(base); b[cnt] = B.getPoi(PI + base); ++cnt;
	} else if (sgn(d2 - rsum * rsum) > 0) {
		ang = acos((A.r + B.r) / sqrt(d2));
		a[cnt] = A.getPoi(base + ang); b[cnt] = B.getPoi(PI + base + ang); ++cnt;
		a[cnt] = A.getPoi(base - ang); b[cnt] = B.getPoi(PI + base - ang); ++cnt;
	}

	for (int i = 0; i < cnt; ++i)
		if (a[i] == b[i])
			b[i] = a[i] + (a[i] - A).norm();

	return cnt;
}

bool inTriangle(Poi x, Poi a, Poi b, Poi c) {
	int s0, s1, s2;
	s0 = sgn((a - x).cross(b - x));
	s1 = sgn((b - x).cross(c - x));
	s2 = sgn((c - x).cross(a - x));
	return s0 == s1 && s1 == s2;
}

int getLineInter(Poi a, Poi b, Poi c, Poi d, Poi&i) {
	b = b - a, d = d - c;
	Poi u = a - c;
	db e = b.cross(d);
	if (sgn(e) == 0) return 0;
	db t = d.cross(u) / e;
	i = a + b * t;
	return 1;
}

db disToLine(Poi p, Poi a, Poi b) {
	Poi v1 = b - a, v2 = p - a;
	return fabs(v1.cross(v2)) / sqrt(v1.len2());
}

Poi getProj(Poi p, Poi a, Poi b) {
	return a + (b - a) / sqrt(len2(b - a)) * (p - a).cross(b - a);
}

db disToSeg(Poi p, Poi a, Poi b) {
	if (sgn(len2(a - b)) == 0) return sqrt(len2(p - a));
	if (sgn((b - a).dot(p - a)) < 0) return sqrt(len2(a - p));
	if (sgn((a - b).dot(p - b)) < 0) return sqrt(len2(b - p));
	return fabs((b - a).cross(p - a)) / sqrt(len2(b - a));
}

bool isInteger(db x) {
	return sgn(x - floor(x)) == 0 || sgn(x - ceil(x)) == 0;
}
int toInt(db x) {
	if (fabs(x - floor(x)) < fabs(x - ceil(x)))
		return floor(x);
	return ceil(x);
}

const int N = 1e5 + 100;
int ass[N];
pair<db, pair<int, int>> nearestPair(int l, int r, Poi*p) {
	using pp = pair<db, pair<int, int> >;
	if (l == r)
		return {1e20, {l, l}};
	if (l + 1 == r)
		return {sqrt(len2(p[l] - p[r])), {l, r}};
	int m = (l + r) >> 1, cnt = 0;
	pp lp = nearestPair(l, m, p), rp = nearestPair(m + 1, r, p), ret = lp.fir < rp.fir ? lp : rp;
	db midx = p[m].x;
	for (int i = l; i <= r; ++i)
		if (sgn(fabs(p[i].x - midx) - ret.fir) <= 0)
			ass[cnt++] = i;
	sort(ass, ass + cnt, [p](const auto&a, const auto&b) {
			return sgn(p[a].y - p[b].y) < 0;
			});
	for (int i = 0; i < cnt; ++i) {
		int k = cnt < (i + 7) ? cnt : i + 7;
		for (int j = i + 1; j < k; ++j) {
			db tmp = sqrt(len2(p[ass[i]] - p[ass[j]]));
			if (sgn(tmp - ret.fir) < 0)
				ret = {tmp, {i, j}};
		}
	}
	return ret;
}

Poi p[N];

int n, a[N];

int main() {

	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		a[i] += a[i - 1];
	}
	for (int i = 1; i <= n; ++i)
		p[i] = Poi(i, a[i]);
	sort(p + 1, p + n + 1, [](const auto&a, const auto&b) {
			return sgn(a.x - b.x) < 0 || (sgn(a.x - b.x) == 0 && sgn(a.y - b.y) < 0);
			});
	auto pir = nearestPair(1, n, p);
	//printf("%d %d\n", pir.second.first, pir.second.second);
	printf("%d\n", toInt(len2(p[pir.second.first] - p[pir.second.second])));

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef double db;
#define fir first
#define sec second
const db PI = atan2(0, -1);
const db EPS = 1e-8;
db sqr(db x) {
	return x * x;
}
int sgn(db x) {
	return x < -EPS ? -1 : EPS < x;
}

struct Poi {
	db x, y;
	Poi() {}
	Poi(db x, db y):x(x), y(y) {}
	db cross(const Poi&rhs) {
		return x * rhs.y - y * rhs.x;
	}
	db dot(const Poi&rhs) {
		return x * rhs.x + y * rhs.y;
	}
	db len2() {
		return dot(*this);
	}
	Poi operator + (const Poi&rhs) {
		return Poi(x + rhs.x, y + rhs.y);
	}
	Poi operator - (const Poi&rhs) {
		return Poi(x - rhs.x, y - rhs.y);
	}
	Poi operator * (db p) {
		return Poi(x * p, y * p);
	}
	Poi operator / (db p) {
		return Poi(x / p, y / p);
	}
	bool operator == (const Poi&rhs) {
		return sgn(x - rhs.x) == 0 && sgn(y - rhs.y) == 0;
	}
	Poi norm() {
		return Poi(-y, x);
	}
	db ang() {
		db a = atan2(y, x);
		if (a < 0) a += PI * 2;
		return a;
	}
};

db len2(Poi a) {
	return a.len2();
}

struct Cir:Poi {
	db r;
	Cir() {}
	Cir(db _x, db _y, db r):r(r) {
		x = _x, y = _y;
	}
	Poi getPoi(db ang) {
		return Poi(x + cos(ang) * r, y + sin(ang) * r);
	}
};

int getTangents(Cir A, Cir B, Poi*a, Poi*b) {
	int cnt = 0;
	if (A.r < B.r) { swap(A, B), swap(a, b); }
	db d2 = (A - B).len2();
	db rdiff = A.r - B.r;
	db rsum = A.r + B.r;
	if (d2 < rdiff * rdiff) return 0;

	db base = (B - A).ang();
	if (sgn(d2) == 0 && sgn(A.r - B.r) == 0) return -1;

	if (sgn(d2 - rdiff * rdiff) == 0) {
		a[cnt] = A.getPoi(base); b[cnt] = B.getPoi(base); ++cnt;
		return 1;
	}

	db ang = acos((A.r - B.r) / sqrt(d2));
	a[cnt] = A.getPoi(base + ang); b[cnt] = B.getPoi(base + ang); ++cnt;
	a[cnt] = A.getPoi(base - ang); b[cnt] = B.getPoi(base - ang); ++cnt;
	if (sgn(d2 - rsum * rsum) == 0) {
		a[cnt] = A.getPoi(base); b[cnt] = B.getPoi(PI + base); ++cnt;
	} else if (sgn(d2 - rsum * rsum) > 0) {
		ang = acos((A.r + B.r) / sqrt(d2));
		a[cnt] = A.getPoi(base + ang); b[cnt] = B.getPoi(PI + base + ang); ++cnt;
		a[cnt] = A.getPoi(base - ang); b[cnt] = B.getPoi(PI + base - ang); ++cnt;
	}

	for (int i = 0; i < cnt; ++i)
		if (a[i] == b[i])
			b[i] = a[i] + (a[i] - A).norm();

	return cnt;
}

bool inTriangle(Poi x, Poi a, Poi b, Poi c) {
	int s0, s1, s2;
	s0 = sgn((a - x).cross(b - x));
	s1 = sgn((b - x).cross(c - x));
	s2 = sgn((c - x).cross(a - x));
	return s0 == s1 && s1 == s2;
}

int getLineInter(Poi a, Poi b, Poi c, Poi d, Poi&i) {
	b = b - a, d = d - c;
	Poi u = a - c;
	db e = b.cross(d);
	if (sgn(e) == 0) return 0;
	db t = d.cross(u) / e;
	i = a + b * t;
	return 1;
}

db disToLine(Poi p, Poi a, Poi b) {
	Poi v1 = b - a, v2 = p - a;
	return fabs(v1.cross(v2)) / sqrt(v1.len2());
}

Poi getProj(Poi p, Poi a, Poi b) {
	return a + (b - a) / sqrt(len2(b - a)) * (p - a).cross(b - a);
}

db disToSeg(Poi p, Poi a, Poi b) {
	if (sgn(len2(a - b)) == 0) return sqrt(len2(p - a));
	if (sgn((b - a).dot(p - a)) < 0) return sqrt(len2(a - p));
	if (sgn((a - b).dot(p - b)) < 0) return sqrt(len2(b - p));
	return fabs((b - a).cross(p - a)) / sqrt(len2(b - a));
}

bool isInteger(db x) {
	return sgn(x - floor(x)) == 0 || sgn(x - ceil(x)) == 0;
}
int toInt(db x) {
	if (fabs(x - floor(x)) < fabs(x - ceil(x)))
		return floor(x);
	return ceil(x);
}

const int N = 1e5 + 100;
bool cmp(const Poi&a, const Poi&b) {
	return sgn(a.x - b.x) < 0 || (sgn(a.x - b.x) == 0 && sgn(a.y - b.y) < 0);
}

bool operator == (const Poi&a, const Poi&b) {
	return a.x == b.x && a.y == b.y;
}

Poi p[N];
db md = 1e20;
void upd(Poi a, Poi b) {
	db tmp = len2(a - b);
	md = tmp < md ? tmp : md;
}

void solve(int l, int r) {
	if (r - l <= 3) {
		for (int i = l; i <= r; ++i)
			for (int j = i + 1; j <= r; ++j)
				upd(p[i], p[j]);
		sort(p + l, p + r + 1, cmp);
	} else {
		int m = (l + r) >> 1;
		db x = p[m].x;
		solve(l, m), solve(m + 1, r);
		int siz = 0;
		static Poi t[N];
		merge(p + l, p + m + 1, p + m + 1, p + r + 1, t, cmp);
		copy(t, t + r - l + 1, p + l);
		for (int i = l; i <= r; ++i)
			if (sqr(p[i].x - x) < md) {
				for (int j = siz - 1; j >= 0 && sqr(p[i].y - t[j].y) < md; --j)
					upd(p[i], t[j]);
				t[siz++] = p[i];
			}
	}
}

int n, a[N];

int main() {
#ifdef lol
	freopen("f.in", "r", stdin);
	freopen("f.out", "w", stdout);
#endif

	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		a[i] += a[i - 1];
	}
	for (int i = 1; i <= n; ++i)
		p[i] = Poi(i, a[i]);
	solve(1, n);
	printf("%d\n", toInt(md));

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef double db;
#define fir first
#define sec second
const db PI = atan2(0, -1);
const db EPS = 1e-8;
db sqr(db x) {
	return x * x;
}
int sgn(db x) {
	return x < -EPS ? -1 : EPS < x;
}

struct Poi {
	db x, y;
	Poi() {}
	Poi(db x, db y):x(x), y(y) {}
	db cross(const Poi&rhs) {
		return x * rhs.y - y * rhs.x;
	}
	db dot(const Poi&rhs) {
		return x * rhs.x + y * rhs.y;
	}
	db len2() {
		return dot(*this);
	}
	Poi operator + (const Poi&rhs) {
		return Poi(x + rhs.x, y + rhs.y);
	}
	Poi operator - (const Poi&rhs) {
		return Poi(x - rhs.x, y - rhs.y);
	}
	Poi operator * (db p) {
		return Poi(x * p, y * p);
	}
	Poi operator / (db p) {
		return Poi(x / p, y / p);
	}
	bool operator == (const Poi&rhs) {
		return sgn(x - rhs.x) == 0 && sgn(y - rhs.y) == 0;
	}
	Poi norm() {
		return Poi(-y, x);
	}
	db ang() {
		db a = atan2(y, x);
		if (a < 0) a += PI * 2;
		return a;
	}
};

db len2(Poi a) {
	return a.len2();
}

struct Cir:Poi {
	db r;
	Cir() {}
	Cir(db _x, db _y, db r):r(r) {
		x = _x, y = _y;
	}
	Poi getPoi(db ang) {
		return Poi(x + cos(ang) * r, y + sin(ang) * r);
	}
};

int getTangents(Cir A, Cir B, Poi*a, Poi*b) {
	int cnt = 0;
	if (A.r < B.r) { swap(A, B), swap(a, b); }
	db d2 = (A - B).len2();
	db rdiff = A.r - B.r;
	db rsum = A.r + B.r;
	if (d2 < rdiff * rdiff) return 0;

	db base = (B - A).ang();
	if (sgn(d2) == 0 && sgn(A.r - B.r) == 0) return -1;

	if (sgn(d2 - rdiff * rdiff) == 0) {
		a[cnt] = A.getPoi(base); b[cnt] = B.getPoi(base); ++cnt;
		return 1;
	}

	db ang = acos((A.r - B.r) / sqrt(d2));
	a[cnt] = A.getPoi(base + ang); b[cnt] = B.getPoi(base + ang); ++cnt;
	a[cnt] = A.getPoi(base - ang); b[cnt] = B.getPoi(base - ang); ++cnt;
	if (sgn(d2 - rsum * rsum) == 0) {
		a[cnt] = A.getPoi(base); b[cnt] = B.getPoi(PI + base); ++cnt;
	} else if (sgn(d2 - rsum * rsum) > 0) {
		ang = acos((A.r + B.r) / sqrt(d2));
		a[cnt] = A.getPoi(base + ang); b[cnt] = B.getPoi(PI + base + ang); ++cnt;
		a[cnt] = A.getPoi(base - ang); b[cnt] = B.getPoi(PI + base - ang); ++cnt;
	}

	for (int i = 0; i < cnt; ++i)
		if (a[i] == b[i])
			b[i] = a[i] + (a[i] - A).norm();

	return cnt;
}

bool inTriangle(Poi x, Poi a, Poi b, Poi c) {
	int s0, s1, s2;
	s0 = sgn((a - x).cross(b - x));
	s1 = sgn((b - x).cross(c - x));
	s2 = sgn((c - x).cross(a - x));
	return s0 == s1 && s1 == s2;
}

int getLineInter(Poi a, Poi b, Poi c, Poi d, Poi&i) {
	b = b - a, d = d - c;
	Poi u = a - c;
	db e = b.cross(d);
	if (sgn(e) == 0) return 0;
	db t = d.cross(u) / e;
	i = a + b * t;
	return 1;
}

db disToLine(Poi p, Poi a, Poi b) {
	Poi v1 = b - a, v2 = p - a;
	return fabs(v1.cross(v2)) / sqrt(v1.len2());
}

Poi getProj(Poi p, Poi a, Poi b) {
	return a + (b - a) / sqrt(len2(b - a)) * (p - a).cross(b - a);
}

db disToSeg(Poi p, Poi a, Poi b) {
	if (sgn(len2(a - b)) == 0) return sqrt(len2(p - a));
	if (sgn((b - a).dot(p - a)) < 0) return sqrt(len2(a - p));
	if (sgn((a - b).dot(p - b)) < 0) return sqrt(len2(b - p));
	return fabs((b - a).cross(p - a)) / sqrt(len2(b - a));
}

bool isInteger(db x) {
	return sgn(x - floor(x)) == 0 || sgn(x - ceil(x)) == 0;
}
int toInt(db x) {
	if (fabs(x - floor(x)) < fabs(x - ceil(x)))
		return floor(x);
	return ceil(x);
}

const int N = 1e5 + 100;
bool cmp(const Poi&a, const Poi&b) {
	return sgn(a.x - b.x) < 0 || (sgn(a.x - b.x) == 0 && sgn(a.y - b.y) < 0);
}
struct NearestPair {
	Poi p[N], t[N];
	db md = 1e20;
	void upd(Poi a, Poi b) {
		db tmp = len2(a - b);
		md = tmp < md ? tmp : md;
	}

	void solve(int l, int r) {
		if (r - l <= 3) {
			for (int i = l; i <= r; ++i)
				for (int j = i + 1; j <= r; ++j)
					upd(p[i], p[j]);
			sort(p + l, p + r + 1, cmp);
		} else {
			int m = (l + r) >> 1;
			db x = p[m].x;
			solve(l, m), solve(m + 1, r);
			merge(p + 1, p + m + 1, p + m + 1, p + r + 1, t, cmp);
			copy(t, t + r - l + 1, p + l);
			int siz = 0;
			for (int i = l; i <= r; ++i)
				if (sqr(p[i].x - x) < md) {
					for (int j = siz - 1; j >= 0 && sqr(p[i].y - t[j].y) < md; --j)
						upd(p[i], t[j]);
					t[siz++] = p[i];
				}
		}
	}
};

Poi p[N];

int n, a[N];

int main() {
#ifdef lol
	freopen("429D.in", "r", stdin);
#endif

	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		a[i] += a[i - 1];
	}
	for (int i = 1; i <= n; ++i)
		p[i] = Poi(i, a[i]);
	sort(p + 1, p + n + 1, [](const auto&a, const auto&b) {
			return sgn(a.x - b.x) < 0 || (sgn(a.x - b.x) == 0 && sgn(a.y - b.y) < 0);
			});
	NearestPair*solver = new NearestPair();
	copy(p + 1, p + n + 1, solver->p + 1);
	solver->solve(1, n);
	printf("%d\n", toInt(solver->md));

	return 0;
}