description: Moamen has an array of n distinct integers. He wants to sort that array in non-decreasing order by doing the following operations in order exactly once:
  
    1. Split the array into exactly k non-empty subarrays such that each element belongs to exactly one subarray. 
    2. Reorder these subarrays arbitrary. 
    3. Merge the subarrays in their new order. 
  
  
  
  A sequence a is a subarray of a sequence b if a can be obtained from b by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
  
  Can you tell Moamen if there is a way to sort the array in non-decreasing order using the operations written above?
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 10^3) — the number of test cases. The description of the test cases follows.
  
  The first line of each test case contains two integers n and k (1 ≤ k ≤ n ≤ 10^5).
  
  The second line contains n integers a_1, a_2, …, a_n (0 ≤ |a_i| ≤ 10^9). It is guaranteed that all numbers are distinct.
  
  It is guaranteed that the sum of n over all test cases does not exceed 3⋅10^5.
  
  Output
  
  For each test case, you should output a single string.
  
  If Moamen can sort the array in non-decreasing order, 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
  
  
  3
  5 4
  6 3 4 2 1
  4 2
  1 -4 0 -2
  5 1
  1 2 3 4 5
  
  
  Output
  
  
  Yes
  No
  Yes
  
  Note
  
  In the first test case, a = [6, 3, 4, 2, 1], and k = 4, so we can do the operations as follows: 
  
    1. Split a into \{ [6], [3, 4], [2], [1] \}. 
    2. Reorder them: \{ [1], [2], [3,4], [6] \}. 
    3. Merge them: [1, 2, 3, 4, 6], so now the array is sorted. 
  
  
  
  In the second test case, there is no way to sort the array by splitting it into only 2 subarrays.
  
  As an example, if we split it into \{ [1, -4], [0, -2] \}, we can reorder them into \{ [1, -4], [0, -2] \} or \{ [0, -2], [1, -4] \}. However, after merging the subarrays, it is impossible to get a sorted array.
solution: import java.io.*;
  import java.nio.charset.StandardCharsets;
  import java.nio.file.Files;
  import java.nio.file.Paths;
  import java.util.*;
  import java.util.stream.Collectors;
  
  public class Solution {
    // @formatter:off
    private static final String inputPath="src/ts2_input.txt", expectedPath="src/ts2_output.txt", outputPath="src/ts2_ans.txt";
    private static int readInt() throws Exception {return Integer.parseInt(br.readLine().trim());}
    private static long readLong() throws Exception {return Long.parseLong(br.readLine().trim());}
    private static int[] readIntArray() throws Exception { String line = br.readLine(); if (line == null || line.isEmpty()) return null; String[] lines = line.trim().split(" "); int n = Integer.parseInt(lines[0]);
      int[] nums = new int[n]; for (int i = 0; i < n; i++) {nums[i] = Integer.parseInt(lines[i + 1]);} return nums; }
    private static int[] readIntArray(int n) throws Exception { int[] nums = new int[n]; String[] lines = br.readLine().trim().split(" "); for (int i = 0; i < n; i++) { nums[i] = Integer.parseInt(lines[i]); } return nums; }
    private static long[] readLongArray(int n) throws Exception { long[] nums = new long[n]; String[] lines = br.readLine().trim().split(" "); for (int i = 0; i < n; i++) { nums[i] = Long.parseLong(lines[i]);} return nums; }
    private static String[] readStringArray(int n) throws Exception { String[] nums = new String[n]; for (int i = 0; i < n; i++) { nums[i] = br.readLine(); } return nums; }
    private static void printArrayInline(int[] nums) throws Exception {for (int i = 0; i < nums.length - 1; i++) {bw.write(nums[i] + " ");}bw.write(nums[nums.length - 1] + "\n");}
    private static void printArrayInline(long[] nums) throws Exception {for (int i = 0; i < nums.length - 1; i++) {bw.write(nums[i] + " ");}bw.write(nums[nums.length - 1] + "\n");}
    private static <T> void printListInLine(List<T> nums) throws Exception {for (int i = 0; i < nums.size() - 1; i++) {bw.write(nums.get(i).toString() + " ");} bw.write(nums.get(nums.size() - 1) + "\n");}
    private static <T> void printListMultiLine(List<T> nums) throws Exception {for (T num : nums) bw.write(num.toString() + "\n");}
    private static void printArrayMultiLine(int[] nums) throws Exception {for (int num : nums) bw.write(num + "\n");}
    private static int parseInt(String str) { return Integer.parseInt(str.trim()); }
    private static int parseInt(String[] str, int i) { return Integer.parseInt(str[i].trim()); }
    private static long parseLong(String str) { return Long.parseLong(str.trim());}
    private static long parseLong(String[] str, int i) {return Long.parseLong(str[i].trim());}
    private static int[] makeRandomArray(int size, int lower, int upper) {Random random = new Random(System.currentTimeMillis());int[] nums = new int[size];for (int i = 0; i < size; i++) {nums[i] = random.nextInt(upper - lower + 1) + lower;}return nums;}
    private static long[] makeRandomLongArray(int size, int lower, int upper) {Random random = new Random(System.currentTimeMillis());long[] nums = new long[size];for (int i = 0; i < size; i++){nums[i] = random.nextInt(upper - lower + 1) + lower;}return nums;}
    private List<Integer>[] makeGraph(int n) {List<Integer>[] graph = new ArrayList[n];for(int i = 0; i < n; i ++) {graph[i] = new ArrayList<>();}return graph;}
    private Set<Integer>[] makeSetGraph(int n) {Set<Integer>[] graph = new HashSet[n];for(int i = 0; i < n; i ++) {graph[i] = new HashSet<>();}return graph;}
    static CustomReader br = new CustomReader(new InputStreamReader(System.in));
    static PrintWriter bw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    //static { try { String env = System.getProperty("env-jay"); if (env != null && env.equals("jay")) { br = new CustomReader(new FileReader(inputPath)); bw = new PrintWriter(new BufferedWriter(new FileWriter(outputPath, false))); }} catch (Throwable e) {}}
    private static void test() throws Exception {
      try {String env = System.getProperty("env-jay");if (env != null && env.equals("jay")) {List<String> output = Files.readAllLines(Paths.get(outputPath), StandardCharsets.UTF_8);List<String> expected = Files.readAllLines(Paths.get(expectedPath), StandardCharsets.UTF_8);
        for(int line = 0; line < Math.max(output.size(), expected.size()); line ++) {if(line == output.size()) {System.err.println(String.format("Line[%d], There is no extra guess.\nExpected:[%s]", line, expected.get(line)));System.exit(-1);}
          if (line == expected.size()) {System.err.println(String.format( "Line[%d], There is no guess.\nOutput:[%s]" , line + 1, output.get(line))); System.exit(-1);}String ans = expected.get(line), guess = output.get(line);
          if (!ans.equals(guess)) {System.err.println(String.format("Line[%d], Wrong guess.\nAnswer:[%s]\nGuess:[%s]", line + 1, ans, guess));System.exit(-2);}}}} catch (Throwable e) {}}
    static class CustomReader {BufferedReader br;StringTokenizer st;public CustomReader(){br = new BufferedReader(new InputStreamReader(System.in));}public CustomReader(Reader in){br = new BufferedReader(in);}
      String next() throws Exception{while (st == null || !st.hasMoreElements()) {st = new StringTokenizer(br.readLine());}return st.nextToken();}int nextInt() throws Exception { return Integer.parseInt(next()); }
      long nextLong() throws Exception { return Long.parseLong(next()); }double nextDouble() throws Exception{return Double.parseDouble(next());}String readLine() throws Exception{return br.readLine();} void close()throws Exception{br.close();}}
    // @formatter:on
  
    public static void main(String[] args) throws Exception {
      int testCases = br.nextInt();
      for (int iter = 1; iter <= testCases; iter++) {
        int n = br.nextInt(), k = br.nextInt();
        var arr = readIntArray(n);
        if(solve(arr, k)) bw.println("YES");
        else bw.println("NO");
      }
      bw.flush();
      bw.close();
      br.close();
      //test();
    }
    private static boolean solve(int[] nums, int k) {
      int n = nums.length;
      int[] sorted = Arrays.copyOf(nums, n);
      Arrays.sort(sorted);
      int count = 1;
      for(int i = 1; i < n; i ++) {
        int left = lowerBound(sorted, nums[i - 1]);
        int right = lowerBound(sorted, nums[i]);
        if(left + 1 != right ) count ++;
      }
      return count <= k;
    }
    private static int lowerBound(int[] nums, int target) {
      int l = 0, r = nums.length;
      while(l < r) {
        var mid = l + (r - l)/2;
        if(nums[mid] >= target) {
          r = mid;
        } else {
          l = mid + 1;
        }
      }
      return l;
    }
  }
  