Why am I getting TLE when complexity is still O(nlogn) as mentioned in Editorial Solution and I used binary search in increasingly sorted array which is O(logn) instead of traversing elements in O(n)

```
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int tests;
cin >> tests;
while(tests--){
int n, k;
cin >> n >> k;
int arr[n];
for(int i=0; i<n; i++){
cin >> arr*;
}
sort(arr, arr+n);
int x = arr[n-(k-1)-1];
int low = 0, high = n-1, mid = (low+high)/2;
while(low<=mid){
if(arr[mid]<x)
low = mid+1;
else
high = mid-1;
mid = (low+high)/2;
}
cout << n-(high+1) << '
```

';

}

return 0;

}