B. Hemose Shopping

Hemose was shopping with his friends Samez, AhmedZ, AshrafEzz, TheSawan and O_E in Germany. As you know, Hemose and his friends are problem solvers, so they are very clever. Therefore, they will go to all discount markets in Germany.

Hemose has an array of 
 integers. He wants Samez to sort the array in the non-decreasing order. Since it would be a too easy problem for Samez, Hemose allows Samez to use only the following operation:

  • Choose indices  and  such that 1,, and ||. Then, swap elements  and .

Can you tell Samez if there's a way to sort the array in the non-decreasing order by using the operation written above some finite number of times (possibly 0)?

Input

Each test contains multiple test cases. The first line contains the number of test cases  (1105). Description of the test cases follows.

The first line of each test case contains two integers  and  (1105).

The second line of each test case contains  integers 1,2,..., (1109).

It is guaranteed that the sum of  over all test cases doesn't exceed 2105.

Output

For each test case, you should output a single string.

If Samez can sort the array in non-decreasing order using the operation written above, output "YES" (without quotes). Otherwise, output "NO" (without quotes).

You can print each letter of "YES" and "NO" in any case (upper or lower).

Example
input
Copy
4
3 3
3 2 1
4 3
1 2 3 4
5 2
5 1 2 3 4
5 4
1 2 3 4 4
output
Copy
NO
YES
YES
YES
Note

In the first test case, you can't do any operations.

In the second test case, the array is already sorted.

In the third test case, you can do the operations as follows:

  • [5,1,2,3,4](1,3)
  • [2,1,5,3,4](2,5)
  • [2,4,5,3,1](2,4)
  • [2,3,5,4,1](1,5)
  • [1,3,5,4,2](2,5)
  • [1,2,5,4,3](3,5)
  • [1,2,3,4,5]

(Here (,) refers to swapping elements at positions ).


#include <bits/stdc++.h>

using namespace std;

#define int            long long int
#define F              first
#define S              second
#define pb             push_back
#define si             set <int>
#define vi             vector <int>
#define pii            pair <int, int>
#define vpi            vector <pii>
#define vpp            vector <pair<int, pii>>
#define mii            map <int, int>
#define mpi            map <pii, int>
#define spi            set <pii>
#define endl           "\n"
#define sz(x)          ((int) x.size())
#define all(p)         p.begin(), p.end()
#define double         long double
#define que_max        priority_queue <int>
#define que_min        priority_queue <int, vi, greater<int>>
#define bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)       for(auto x : a) cout << x << " "; cout << endl
#define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
#define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
  int x = 1;
  while (b)
  {
    if (b & 1) x *= a;
    a *= a;
    b >>= 1;
  }
  return x;
}

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
  const char* comma = strchr (names + 1, ',');
  cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;

void solve() {

int n,x;
cin>>n>>x;

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

bool f=false;
bool t=true;

// if we have x elements on the left or right then we can place it anywhere
if(n>=2*x)f=true;
vector<int>a=v;
sort(a.begin(),a.end());
// else we can place the first n-x and the last n-x and the rest should be in sorted order
for (int i = n-x; i < x; i++)
{
    if(a[i]!=v[i])t=false;
}

if(|| t){
    cout<<"YES\n";
}
else cout<<"NO\n";



}

int32_t main()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);


  clock_t z = clock();

  int t = 1;
  cin >> t; 
  while (t--) solve();



  return 0;
}