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.util.Arrays;
  import java.util.Comparator;
  
  public class B_1557 {
      static class OutputWriter {
          private final PrintWriter writer;
  
          public OutputWriter(OutputStream outputStream) {
              writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
          }
  
          public OutputWriter(Writer writer) {
              this.writer = new PrintWriter(writer);
          }
  
          public void print(Object... objects) {
              for (int i = 0; i < objects.length; i++) {
                  if (i != 0)
                      writer.print(' ');
                  writer.print(objects[i]);
              }
          }
  
          public void printLine(Object... objects) {
              print(objects);
              writer.println();
          }
  
          public void close() {
              writer.close();
          }
      }
  
      static class Reader {
          final private int BUFFER_SIZE = 1 << 16;
          private DataInputStream din;
          private byte[] buffer;
          private int bufferPointer, bytesRead;
  
          public Reader() {
              din = new DataInputStream(System.in);
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }
  
          public Reader(String file_name) throws IOException {
              din = new DataInputStream(new FileInputStream(file_name));
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }
  
          public String readLine() throws IOException {
              byte[] buf = new byte[64]; // line length
              int cnt = 0, c;
              while ((c = read()) != -1) {
                  if (c == '\n')
                      break;
                  buf[cnt++] = (byte) c;
              }
              return new String(buf, 0, cnt);
          }
  
          public int nextInt() throws IOException {
              int ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
  
              if (neg)
                  return -ret;
              return ret;
          }
  
          public long nextLong() throws IOException {
              long ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              }
              while ((c = read()) >= '0' && c <= '9');
              if (neg)
                  return -ret;
              return ret;
          }
  
          public double nextDouble() throws IOException {
              double ret = 0, div = 1;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
  
              do {
                  ret = ret * 10 + c - '0';
              }
              while ((c = read()) >= '0' && c <= '9');
  
              if (c == '.') {
                  while ((c = read()) >= '0' && c <= '9') {
                      ret += (c - '0') / (div *= 10);
                  }
              }
  
              if (neg)
                  return -ret;
              return ret;
          }
  
          private void fillBuffer() throws IOException {
              bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
              if (bytesRead == -1)
                  buffer[0] = -1;
          }
  
          private byte read() throws IOException {
              if (bufferPointer == bytesRead)
                  fillBuffer();
              return buffer[bufferPointer++];
          }
  
          public void close() throws IOException {
              if (din == null)
                  return;
              din.close();
          }
      }
  
      static class Pair {
          int i;
          int v;
  
          public Pair(int i, int v) {
              this.i = i;
              this.v = v;
          }
  
      }
  
      static int ceilSearch(int arr[], int low, int high, int x) {
          int mid;
  
        /* If x is smaller than or equal to the
           first element, then return the first element */
          if (x <= arr[low])
              return low;
  
        /* If x is greater than the last
           element, then return -1 */
          if (x > arr[high])
              return -1;
  
        /* get the index of middle element
           of arr[low..high]*/
          mid = (low + high) / 2;  /* low + (high - low)/2 */
  
        /* If x is same as middle element,
           then return mid */
          if (arr[mid] == x)
              return mid;
  
        /* If x is greater than arr[mid], then
           either arr[mid + 1] is ceiling of x or
           ceiling lies in arr[mid+1...high] */
          else if (arr[mid] < x) {
              if (mid + 1 <= high && x <= arr[mid + 1])
                  return mid + 1;
              else
                  return ceilSearch(arr, mid + 1, high, x);
          }
  
        /* If x is smaller than arr[mid],
           then either arr[mid] is ceiling of x
           or ceiling lies in arr[low...mid-1] */
          else {
              if (mid - 1 >= low && x > arr[mid - 1])
                  return mid;
              else
                  return ceilSearch(arr, low, mid - 1, x);
          }
      }
  
      public static boolean isNext(int arr[], int sorted[], int i) {
          int ceil = ceilSearch(sorted, 0, sorted.length - 1, arr[i] + 1);
          if (ceil == -1)
              return false;
          //        if(ceil == -1)
  //        System.out.println(arr[i] + " " + sorted[ceil]);
          return arr[i + 1] == sorted[ceil];
      }
  
      public static void main(String ar[]) throws IOException {
          Reader input = new Reader();
          OutputWriter out = new OutputWriter(System.out);
  
          int t = input.nextInt();
          while (t-- > 0) {
              int n = input.nextInt();
              int k = input.nextInt();
              int arr[] = new int[n];
              int sorted[] = new int[n];
              for (int i = 0; i < n; i++) {
                  arr[i] = input.nextInt();
                  sorted[i] = arr[i];
              }
  
              Arrays.sort(sorted);
  
              int seg = 0;
              for (int i = 0; i < n; i++) {
                  while (i < n - 1 && isNext(arr, sorted, i)) {
                      i++;
                  }
                  seg++;
              }
  
  //            System.out.println(seg);
              System.out.println(seg <= k ? "yes" : "no");
          }
      }
  }
  