#include<bits/stdc++.h> #define ll long long #define ls u<<1 #define rs u<<1|1 #define mm(x) memset(x,0,sizeof(x)) #define debug(x) cout << #x << ":" << x << '\n' using namespace std; int read() { int a=0;int f=0;char p=getchar(); while(!isdigit(p)){f|=p=='-';p=getchar();} while(isdigit(p)){a=(a<<3)+(a<<1)+(p^48);p=getchar();} return f?-a:a; } const int INF=998244353; int T; int n,m; bool flag; int val[200050]; int t[200050]; int main() { T=read(); while(T--) { n=read(); m=read(); flag=true; for(int i=1;i<=n;++i) val[i]=read(); for(int i=1;i<=n;++i) t[i]=val[i]; sort(t+1,t+n+1); for(int i=n-m+1;i<=m;++i) if(val[i]!=t[i]) flag=false; if(flag) puts("YES"); else puts("NO"); } return 0; }View Code