///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 08/09/21 evening
const solve = (n, k, a) => {
    // pr(n, k, a)
    let m = 1;
    a = a.map((x, i) => [x, i]);
    a.sort((x, y) => {
        if (x[0] == y[0]) return x[1] - y[1];
        return x[0] - y[0];
    })
    // pr(a)
    for (let i = 0; i < n - 1; i++) {
        if (a[i][1] + 1 != a[i + 1][1]) m++;
    }
    // pr(m, k);
    pr(m <= k ? 'Yes' : 'No');
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1], input[i + 1]);
            i += 2;
        }
    });
};

main()

'use strict'
Object.defineProperty(exports, '__esModule', { value: !0 })
var os = require('os')
const idx = []
function calcNumRanks(e) {
  const n = e.length
  if (n <= 0) return [0, []]
  if (1 === n) return [1, [1]]
  idx.length = n
  for (let e = 0; e < n; ++e) idx[e] = e
  idx.sort((n, t) => e[n] - e[t])
  let t = 1
  const i = new Array(n)
  i[idx[0]] = 1
  for (let s = 1, r = e[idx[0]]; s < n; ++s) {
    const n = e[idx[s]]
    n > r && ((t += 1), (r = n)), (i[idx[s]] = t)
  }
  return [t, i]
}
const stdin = process.stdin,
  stdout = process.stdout,
  integerRegex = /-?\d+/g,
  decimalRegex = /-?\d+(?:\.\d+)?/g
class InputAndOutput {
  lineIndex = 0
  lines = []
  dried() {
    return this.lineIndex >= this.lines.length
  }
  readLine() {
    const e = this.lines[this.lineIndex]
    return (this.lineIndex += 1), e
  }
  readIntegersOfLine() {
    const e = this.readLine().match(integerRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  readNumsOfLine() {
    const e = this.readLine().match(decimalRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  print(e) {
    stdout.write(e)
  }
  async init() {
    const e = await this.readLines()
    this.lines = e
  }
  readLines() {
    const e = []
    return new Promise(n => {
      stdin.on('data', n => e.push(n)),
        stdin.on('end', function () {
          const t = e.join('').split(os.EOL)
          n(t)
        })
    })
  }
}
async function __main__(e) {
  const n = new InputAndOutput()
  await n.init(), e(n)
}
function solve(e, n, t) {
  const [, i] = calcNumRanks(t)
  let s = 1
  for (let n = 0, t = e - 1; n < t; ++n) i[n + 1] !== i[n] + 1 && (s += 1)
  return s <= n
}
__main__(function (e) {
  const n = Number(e.readLine())
  for (let t = 1; t <= n; ++t) {
    const [n, t] = e.readIntegersOfLine(),
      i = solve(n, t, e.readIntegersOfLine())
    e.print((i ? 'YES' : 'NO') + '\n')
  }
})

'use strict'
Object.defineProperty(exports, '__esModule', { value: !0 })
var os = require('os')
const idx = []
function calcNumRanks(e) {
  const n = e.length
  if (n <= 0) return [0, []]
  if (1 === n) return [1, [1]]
  idx.length = n
  for (let e = 0; e < n; ++e) idx[e] = e
  idx.sort((n, t) => e[n] - e[t])
  let t = 1
  const i = new Array(n)
  i[idx[0]] = 1
  for (let s = 1, r = e[idx[0]]; s < n; ++s) {
    const n = e[idx[s]]
    n > r && ((t += 1), (r = n)), (i[idx[s]] = t)
  }
  return [t, i]
}
const stdin = process.stdin,
  stdout = process.stdout,
  integerRegex = /-?\d+/g,
  decimalRegex = /-?\d+(?:\.\d+)?/g
class InputAndOutput {
  lineIndex = 0
  lines = []
  dried() {
    return this.lineIndex >= this.lines.length
  }
  readLine() {
    const e = this.lines[this.lineIndex]
    return (this.lineIndex += 1), e
  }
  readIntegersOfLine() {
    const e = this.readLine().match(integerRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  readNumsOfLine() {
    const e = this.readLine().match(decimalRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  print(e) {
    stdout.write(e)
  }
  async init() {
    const e = await this.readLines()
    this.lines = e
  }
  readLines() {
    const e = []
    return new Promise(n => {
      stdin.on('data', n => e.push(n)),
        stdin.on('end', function () {
          const t = e.join('').split(os.EOL)
          n(t)
        })
    })
  }
}
async function __main__(e) {
  const n = new InputAndOutput()
  await n.init(), e(n)
}
function solve(e, n, t) {
  const [, i] = calcNumRanks(t)
  let s = e
  for (let n = 0, t = e - 1; n < t; ++n) i[n + 1] === i[n] + 1 && (s -= 1)
  return s <= n
}
__main__(function (e) {
  const n = Number(e.readLine())
  for (let t = 1; t <= n; ++t) {
    const [n, t] = e.readIntegersOfLine(),
      i = solve(n, t, e.readIntegersOfLine())
    e.print((i ? 'YES' : 'NO') + '\n')
  }
})

"use strict";

const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, k] = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));
    let arr = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));
    if (n === k) {
      console.log("YES");
      continue;
    }
    for (let i = 0; i < n; i++) {
      let k = { val: arr[i], ind: i };
      arr[i] = k;
    }
    arr.sort((a, b) => a.val - b.val);
    let cnt = 1;
    for (let i = 1; i < n; i++) {
      if (arr[i - 1].ind + 1 !== arr[i].ind) cnt++;
    }
    if (cnt <= k) console.log("YES");
    else console.log("NO");
  }
};
solve();

let examplesStrings = [
`3
5 4
6 3 4 2 1
4 2
1 -4 0 -2
5 1
1 2 3 4 5`,
// `3
// 1 2 3`,
// `9
// 1 2 1 3 2 2 2 2 3`
];

let examples = [
    [
        [
            {k: 4, arr: [6,3,4,2,1]}
        ],
        [
            {k: 2, arr: [1, -4, 0, -2]}
        ],
        [
            {k: 14, arr: [1,2,3,4,5]}
        ]
    ],
    // [1,2,3],
    // [1,2,1,3,2,2,2,2,3]
];

let answers = [
`YES
NO
YES`
// `2`,
// `4`,
// '10'
];

//

const parser = (string) => {
    const lines = string.match(/[^\r\n]+/g);

    // return lines[1].split(' ').map(x => parseInt(x, 10))

    const finalResult = [];
    for(let i = 1; i < lines.length; i+=2) {
        finalResult.push({
            k: lines[i].split(' ').map(x => parseInt(x, 10))[1],
            arr: lines[i+1].split(' ').map(x => parseInt(x, 10))
        })
    }
    return finalResult;
}

const solver = (arr2d) => {

    function binarySearch(arr, val) {
        let start = 0;
        let end = arr.length - 1;

        while (start <= end) {
          let mid = Math.floor((start + end) / 2);

          if (arr[mid] === val) {
            return mid;
          }

          if (val < arr[mid]) {
            end = mid - 1;
          } else {
            start = mid + 1;
          }
        }
        return -1;
      }

    return arr2d.map(({k, arr}) => {
        const sorted = arr.slice(0);
        sorted.sort((a,b) => a-b);

        let subArrCount = 0;

        let originalIndex = null;
        for(let i = 0; i < arr.length; i++) {
            // if (originalIndex === null) {
            //     subArrCount++;
            //     originalIndex = i;
            // }

            if ( (originalIndex === null) || (arr[i] !== sorted[++originalIndex])) {
                // console.log('new', i, originalIndex)
                subArrCount++;

                originalIndex = binarySearch(sorted, arr[i]);
                // originalIndex2 = arr.indexOf(sorted[i]);

                // console.log({originalIndex, originalIndex2, arr, el: sorted[i]})
            }

            // if ()
        }

        // console.log({k, arr, sorted, subArrCount})

        return (k >= subArrCount) ? 'YES' : 'NO';
    }).join("\r\n")

};

const multiSolver = (_inputs) => {
    const isMulti = false;

    const inputs = isMulti ? _inputs : [_inputs];

    let results = [];
    for(let input of inputs) {
        results.push(solver(input));
        // logResult(solver(input))
    }
    console.log({results})
    const strResults = results.join("\r\n");
    logResult(strResults);
    return strResults;

}

// FINISH HERE !!!
// STOP
// STOP

const isDevMode = process.env.LOCAL === 'knotri';
const logResult = console.log;

const deepEq = (obj1, obj2) => JSON.stringify(obj1) === JSON.stringify(obj2)
const validate = ({examplesStrings, examples, answers, parser, multiSolver}) => {
    examplesStrings.forEach((string, index) => {
        const actualParse = parser(string);
        const desiredParse = examples[index];

        if (!deepEq(actualParse, desiredParse)) {
            console.error('PARSE WRONG!');
            console.log({actualParse, desiredParse})
        }

        const actualAnswer = multiSolver(actualParse);
        const desiredAnswer = answers[index];

        if (!deepEq(actualAnswer, desiredAnswer)) {
            console.error('SOLVE WRONG!');
            console.log({actualParse, actualAnswer, desiredAnswer})
        }

    });

}

if (!isDevMode) {
    console.log = () => {};
    const fs = require("fs");
    const stdinBuffer = fs.readFileSync(0);
    const string = stdinBuffer.toString();

    multiSolver(parser(string));
} else {
    validate({examplesStrings, examples, answers, parser, multiSolver})
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main()
});

function readline() {
  return inputString[currentLine++]
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // console.time('Execution Time')
  let testCases = readline()
  while(testCases--)
    solve()
  // console.timeEnd('Execution Time');
}

// function to solve problems
function solve (){
  let [n, k] = readline().split(' ')
  let arr = readline().split(' ').map(x => +x),
    ansArr = []

  // copy arr
  arr.forEach(num => {
    ansArr.push(num)
  })
  ansArr.sort(sortAscending)
  let ansMap = new Map()
  for (let i=0; i < ansArr.length; i++) {
    ansMap.set(ansArr[i], i)
  }
  for (let i=0; i < arr.length - 1 && k > 0; i++) {
    // check it's agad no is same as ans arr
    // find index
    let index = ansMap.get(arr[i])
    if ((index - ansMap.get(arr[i+1])) != -1) {
      // not consecutive - make bracket
      k--
    }
  }
  (k > 0) ? console.log('YES') : console.log('NO')
}

function sortAscending(a, b) {
  return a - b
}
// String.prototype.replaceAt = function (index, replacement) {
//   return this.substring(0, index) + replacement + this.substring(index + replacement.length)
// }

//Copy arr
// Map vs array

function solve() {
   const [n, k] = readArray(Number);
   const arr = readArray((x, i) => [Number(x), i]);
   arr.sort((a, b) => a[0] - b[0]);
   let goodCounter = 0;
   for (let i = 1; i < n; i++) {
      if (arr[i - 1][1] + 1 === arr[i][1]) {
         goodCounter++;
      }
   }
   write(goodCounter + k >= n ? 'YES' : 'NO');
}

function init() {
   try {
      var T;
      T = 1;
      T = Number(read());
      for (var t = 0; t < T; t++) {
         solve();
      }
   } catch (e) {
      write(e);
   }
}

function isZero(num) {
   if (typeof num === 'bigint') {
      return num === 0n;
   }
   return num === 0;
}
function div(a, b) {
   if (typeof a !== typeof b) {
      throw new Error('Different types on division');
   }
   if (typeof a === 'bigint') {
      return a / b;
   }
   return Math.floor(a / b);
}

function gcd(x, y) {
   if (isZero(y)) {
      return x;
   }
   return gcd(y, x % y);
}

function lcm(x, y) {
   return div(x * y, gcd(x, y));
}

function allIndexOf(arr, value) {
   var index = arr.indexOf(value)
   var ans = [];
   while (index !== -1) {
      ans.push(index);
      index = arr.indexOf(value, index + 1);
   }
   return ans;
}

function xor(a, b, k) {
   if (k === 2) {
      return a ^ b;
   }
}

function decToBin(num) {
   let n = num;
   const ans = [];
   while(n > 0) {
      ans.push(n & 1);
      n = (n >> 1);
   }
   return ans;
}

function binToDec(binN) {
   let ans = 0;
   for (let i = binN.length - 1; i >= 0; i--) {
      ans = ((ans << 1) | binN[i]);
   }
   return ans;
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function readArray(f) {
   return read().split(' ').map(f);
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

'use strict'
Object.defineProperty(exports, '__esModule', { value: !0 })
var os = require('os')
const idx = []
function calcNumRanks(e) {
  const n = e.length
  if (n <= 0) return [0, []]
  if (1 === n) return [1, [1]]
  idx.length = n
  for (let e = 0; e < n; ++e) idx[e] = e
  idx.sort((n, t) => e[n] - e[t])
  let t = 1
  const i = new Array(n)
  i[idx[0]] = 1
  for (let s = 1, r = e[idx[0]]; s < n; ++s) {
    const n = e[idx[s]]
    n > r && ((t += 1), (r = n)), (i[idx[s]] = t)
  }
  return [t, i]
}
const stdin = process.stdin,
  stdout = process.stdout,
  integerRegex = /-?\d+/g,
  decimalRegex = /-?\d+(?:\.\d+)?/g
class InputAndOutput {
  lineIndex = 0
  lines = []
  dried() {
    return this.lineIndex >= this.lines.length
  }
  readLine() {
    const e = this.lines[this.lineIndex]
    return (this.lineIndex += 1), e
  }
  readIntegersOfLine() {
    const e = this.readLine().match(integerRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  readNumsOfLine() {
    const e = this.readLine().match(decimalRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  print(e) {
    stdout.write(e)
  }
  async init() {
    const e = await this.readLines()
    this.lines = e
  }
  readLines() {
    const e = []
    return new Promise(n => {
      stdin.on('data', n => e.push(n)),
        stdin.on('end', function () {
          const t = e.join('').split(os.EOL)
          n(t)
        })
    })
  }
}
async function __main__(e) {
  const n = new InputAndOutput()
  await n.init(), e(n)
}
function solve(e, n, t) {
  const [, i] = calcNumRanks(t)
  let s = 0
  for (let n = 0, t = e - 1; n < t; ++n)
    i[n + 1] !== i[n] && i[n + 1] !== i[n] + 1 && (s += 1)
  return s <= n
}
__main__(function (e) {
  const n = Number(e.readLine())
  for (let t = 1; t <= n; ++t) {
    const [n, t] = e.readIntegersOfLine(),
      i = solve(n, t, e.readIntegersOfLine())
    e.print((i ? 'YES' : 'NO') + '\n')
  }
})

'use strict'
Object.defineProperty(exports, '__esModule', { value: !0 })
var os = require('os')
const idx = []
function calcNumRanks(e) {
  const n = e.length
  if (n <= 0) return [0, []]
  if (1 === n) return [1, [1]]
  idx.length = n
  for (let e = 0; e < n; ++e) idx[e] = e
  idx.sort((n, t) => e[n] - e[t])
  let t = 1
  const i = new Array(n)
  i[idx[0]] = 1
  for (let s = 1, r = e[idx[0]]; s < n; ++s) {
    const n = e[idx[s]]
    n > r && ((t += 1), (r = n)), (i[idx[s]] = t)
  }
  return [t, i]
}
const stdin = process.stdin,
  stdout = process.stdout,
  integerRegex = /-?\d+/g,
  decimalRegex = /-?\d+(?:\.\d+)?/g
class InputAndOutput {
  lineIndex = 0
  lines = []
  dried() {
    return this.lineIndex >= this.lines.length
  }
  readLine() {
    const e = this.lines[this.lineIndex]
    return (this.lineIndex += 1), e
  }
  readIntegersOfLine() {
    const e = this.readLine().match(integerRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  readNumsOfLine() {
    const e = this.readLine().match(decimalRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  print(e) {
    stdout.write(e)
  }
  async init() {
    const e = await this.readLines()
    this.lines = e
  }
  readLines() {
    const e = []
    return new Promise(n => {
      stdin.on('data', n => e.push(n)),
        stdin.on('end', function () {
          const t = e.join('').split(os.EOL)
          n(t)
        })
    })
  }
}
async function __main__(e) {
  const n = new InputAndOutput()
  await n.init(), e(n)
}
function solve(e, n, t) {
  const [, i] = calcNumRanks(t)
  let s = 0
  for (let n = 0, t = e - 1; n < t; ++n) i[n + 1] !== i[n] + 1 && (s += 1)
  return s <= n
}
__main__(function (e) {
  const n = Number(e.readLine())
  for (let t = 1; t <= n; ++t) {
    const [n, t] = e.readIntegersOfLine(),
      i = solve(n, t, e.readIntegersOfLine())
    e.print((i ? 'YES' : 'NO') + '\n')
  }
})

'use strict'
Object.defineProperty(exports, '__esModule', { value: !0 })
var os = require('os')
const idx = []
function calcNumRanks(e) {
  const n = e.length
  if (n <= 0) return [0, []]
  if (1 === n) return [1, [1]]
  idx.length = n
  for (let e = 0; e < n; ++e) idx[e] = e
  idx.sort((n, t) => e[n] - e[t])
  let t = 1
  const i = new Array(n)
  i[idx[0]] = 1
  for (let s = 1, r = e[idx[0]]; s < n; ++s) {
    const n = e[idx[s]]
    n > r && ((t += 1), (r = n)), (i[idx[s]] = t)
  }
  return [t, i]
}
const stdin = process.stdin,
  stdout = process.stdout,
  integerRegex = /-?\d+/g,
  decimalRegex = /-?\d+(?:\.\d+)?/g
class InputAndOutput {
  lineIndex = 0
  lines = []
  dried() {
    return this.lineIndex >= this.lines.length
  }
  readLine() {
    const e = this.lines[this.lineIndex]
    return (this.lineIndex += 1), e
  }
  readIntegersOfLine() {
    const e = this.readLine().match(integerRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  readNumsOfLine() {
    const e = this.readLine().match(decimalRegex)
    return null == e ? [] : e.map(e => Number(e))
  }
  print(e) {
    stdout.write(e)
  }
  async init() {
    const e = await this.readLines()
    this.lines = e
  }
  readLines() {
    const e = []
    return new Promise(n => {
      stdin.on('data', n => e.push(n)),
        stdin.on('end', function () {
          const t = e.join('').split(os.EOL)
          n(t)
        })
    })
  }
}
async function __main__(e) {
  const n = new InputAndOutput()
  await n.init(), e(n)
}
function solve(e, n, t) {
  const [, i] = calcNumRanks(t)
  let s = 0
  for (let n = 1; n < e; ++n) i[n] !== i[n - 1] + 1 && (s += 1)
  return s <= n
}
__main__(function (e) {
  const n = Number(e.readLine())
  for (let t = 1; t <= n; ++t) {
    const [n, t] = e.readIntegersOfLine(),
      i = solve(n, t, e.readIntegersOfLine())
    e.print((i ? 'YES' : 'NO') + '\n')
  }
})

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * 08/09/21 morning
 * https://codeforces.com/contest/1557/problem/B
 */
const solve = (n, k, a) => {
    // pr(n, k, a)
    if (k == n) return pr('Yes')
    let tmp = LISA(a);
    let [m, d] = tmp;
    // pr(m, n - m + 1, k, d)
    if (n - m + 1 <= k) return pr('Yes');
    let sum = sm(d);
    if (n - sum + d.length <= k) return pr('Yes');
    pr('No')
};

const LISA = (a) => {
    let max = 1, len = 1, n = a.length, d = [];
    for (let i = 1; i < n; i++) {
        if (a[i] >= a[i - 1]) {
            len++;
        } else {
            d.push(len)
            if (len > max) max = len;
            len = 1;
        }
    }
    if (len > max) max = len;
    return [max, d];
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1], input[i + 1]);
            i += 2;
        }
    });
};

main()

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * 08/09/21 morning
 * https://codeforces.com/contest/1557/problem/B
 */
const solve = (n, k, a) => {
    // pr(n, k, a)
    if (k == n) return pr('Yes')
    let tmp = LISA(a);
    let [m, cnt] = tmp;
    // pr(m, n - m + 1, k, 'cnt', cnt)
    if (n - m + 1 <= k) return pr('Yes');
    pr('No')
};

const LISA = (a) => {
    let max = 1, len = 1, n = a.length, cnt = 0;
    for (let i = 1; i < n; i++) {
        if (a[i] >= a[i - 1]) {
            len++;
        } else {
            cnt++;
            if (len > max) max = len;
            len = 1;
        }
    }
    if (len > max) max = len;
    return [max, cnt];
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1], input[i + 1]);
            i += 2;
        }
    });
};

main()

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * 08/09/21 morning
 * https://codeforces.com/contest/1557/problem/B
 */
const solve = (n, k, a) => {
    // pr(n, k, a)
    if (k == n) return pr('Yes')
    let m = LISA(a);
    // pr(m, n - m + 1, k)
    if (n - m + 1 > k) return pr('No');
    pr('Yes')
};

const LISA = (a) => {
    let max = 1, len = 1, n = a.length;
    for (let i = 1; i < n; i++) {
        if (a[i] > a[i - 1]) {
            len++;
        } else {
            if (max < len) max = len;
            len = 1;
        }
    }
    if (len > max) max = len;
    return max;
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1], input[i + 1]);
            i += 2;
        }
    });
};

main()

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * 08/09/21 morning
 * https://codeforces.com/contest/1557/problem/B
 */
const solve = (n, k, a) => {
    // pr(n, k, a)
    let m = LISA(a);
    // pr(m, n - m + 1, k)
    if (n - m + 1 <= k) return pr('Yes');
    pr('No')
};

const LISA = (a) => {
    let max = 1, len = 1, n = a.length;
    for (let i = 1; i < n; i++) {
        if (a[i] > a[i - 1]) {
            len++;
        } else {
            if (max < len) max = len;
            len = 1;
        }
    }
    if (len > max) max = len;
    return max;
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1], input[i + 1]);
            i += 2;
        }
    });
};

main()

"use strict";

const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, k] = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));
    let arr = readline()
      .trim()
      .split(" ")
      .map((cur) => parseInt(cur));
    if (n === k) {
      console.log("YES");
      continue;
    }
    for (let i = 0; i < n; i++) {
      let k = { val: arr[i], ind: i };
      arr[i] = k;
    }
    arr.sort((a, b) => a.val - b.val);
    let cnt = 0;
    for (let i = 1; i < n; i++) {
      if (arr[i - 1].ind + 1 !== arr[i].ind) cnt++;
    }
    if (cnt <= k) console.log("YES");
    else console.log("NO");
  }
};
solve();


print(function(n, k) {
	var f = new Int8Array(1e5 + 5);
	var cnt = 0;
	for (var i = 0; i < n; i++)
		readline().split(' ').map(Number).reduce(function(l, r) {
			cnt += r - l + 1;
		});

	return k * Math.ceil(cnt / k) - cnt;

} .apply(0, readline().split(' ').map(Number)));

print(function(n, k) {
	var cnt = 0;
	for (var i = 0; i < n; i++)
		readline().split(' ').map(Number).reduce(function(l, r) {
			cnt += r - l + 1;
		});

	return k * Math.ceil(cnt / k) - cnt;

} .apply(0, readline().split(' ').map(Number)));

ip = readline().split(" ");
n = parseInt(ip[0]);
k = parseInt(ip[1]);
sum = 0;
ats = 0;

for (var i = 0; i < n; i++){
	ip = readline().split(" ");
	l = parseInt(ip[0]);
	r = parseInt(ip[1]);
	sum += (Math.abs(r-l)+1);
}
if (sum % k != 0){
	ats = k - (sum % k);
}
write(ats);

;(function () {

	print(function () {

		var p = readline().split(' ').map(Number),
			n = p[0], k = p[1]; p = 0;

		while (n--) {
			p += readline().split(' ').map(Number).reduce(function (a, b) { return b - a + 1; });
		}

		if ((p % k) === 0) return 0;

		return (parseInt(p/k) + 1) * k - p;

	}());

}.call(this));

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var integers = tokenizeIntegers(readline());
	var spanNum = integers[0], factor = integers[1];

	var total = 0;

	for (var i = 0; i < spanNum; i += 1) {
		var span = tokenizeIntegers(readline());
		total += span[1] - span[0] + 1;
	}

	print((factor-total%factor)%factor);
}

main();

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var integers = tokenizeIntegers(readline());
	var spanNum = integers[0], factor = integers[1];

	var total = 0;

	for (var i = 0; i < spanNum; i += 1) {
		var span = tokenizeIntegers(readline());
		total += span[1] - span[0] + 1;
	}

	print(Math.min(total%factor, factor-total%factor));
}

main();


  var tmp = readline().split(' ').map(function(x) {
    return parseInt(x);
  });
  var n = tmp[0];
  var k = tmp[1];
  var d = readline().split(' ').map(function(x) {
    return parseInt(x);
  });
  var children = new Array(n).fill(0).map(function(x, i) {
    return i + 1;
  });
  var curr = 0;
  var res = [];
  for(var i = 0; i < k; i += 1) {
    curr = (curr + d[i] % children.length) % children.length;
    res.push(children[curr]);
    children.splice(curr, 1);
  }
  print(res.join(' '));

var params = readline().split(" ").map(function convert(value) {return +value; });
var n = params[0];
var k = params[1];
var input = readline().split(" ").map(function convert(value) {return +value;});
var children = [];
var answer = [];
var prevChildIndex = 0;

for (var i = 1; i <= n; i++)
	children.push(i);

for (var i = 0; i < k; i++ ) {
	var curChildIndex = (prevChildIndex + input[i]) % children.length;
	answer.push(children.splice(curChildIndex, 1));
	prevChildIndex = curChildIndex % children.length;
}

print(answer.join(" "));

if (typeof print === 'undefined') print = console.log;
if (typeof readline === 'undefined') readline = (function() {
    var lines = require('fs').readFileSync('/dev/stdin').toString().split('\n');
    var id = 0;
    return function() {return lines[id++];}
})();

var t = readline().split(' ');
var n = +t[0], q = +t[1];
var a = readline().split(' ' ).map(function(x) { return (+x); });

var qu = [], ans = [];
for (var i = -1; ++i < n; ) qu.push(i + 1);

for (var i = -1; ++i < q; ) {
    var k = (a[i]) % qu.length;
    //console.warn(k);
    for (var f = k; f--; ) {
        qu.push(qu[0]);
        qu.shift();
    }
    ans.push(qu.shift());
}
print(ans.join(' '));

/*
    The idea to solve this problem is by using index of child number in array instead of
    using the child number itself.

    If we are using index, we could get consistent behavior with mod formula. For example
    if we want to move 7 times on circular array which have 7 elements starting from index
    after 0 (index 1), then we will arrive again at index 0 ((0 + 7) % 7 = 0).
*/

var params = readline().split(' ').map(Number),
    n = params[0],
    k = params[1];

var counts = readline().split(' ').map(Number),
    children = [],
    eliminated_children = [];

var leaderIdx = 0;

for(var i = 1; i <= n; i++)
    children.push(i);

for(var i = 0; i < k; i++) {

    var eliminatedIdx = (leaderIdx + counts[i]) % children.length;

    eliminated_children.push(children.splice(eliminatedIdx, 1));
    leaderIdx = eliminatedIdx % children.length;
}

print(eliminated_children.join(' '));

var params = readline().split(" ").map(function convert(value) {return +value; });
var n = params[0];
var k = params[1];
var input = readline().split(" ").map(function convert(value) {return +value;});
var children = [];
var answer = [];
var prevChildIndex = 0;

for (var i = 1; i <= n; i++)
	children.push(i);

for (var i = 0; i < k; i++ ) {
	var curChildIndex = (prevChildIndex + input[i]) % children.length;
	answer.push(children.splice(curChildIndex, 1));
	prevChildIndex = curChildIndex % children.length;
}

print(answer);


let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
	var t = lines[0];
	var n = 0;
	var h = 0;
	for(i = 1; i <= t * 2; i++) {
		var a = lines[i].split(' ').map(Number);
        if(i % 2 == 1){
            n = a[0]; h = a[1];
        }else{
            a = a.sort(function(a, b){return b - a});
    		var x = a[0]; var y = a[1];
    		var b = 2 * Math.floor(h / (x + y)); var c = h % (x + y);
            if(c === 0){

            }else if(c <= x){
    			b++;
    		}else {
    			b+=2;
    		}
    		console.log(b);
        }
	}
});

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var N = nextInt();
		var X = nextInt();
		var list = nextIntArray(N);
		list.sort(function(a,b){
			return b - a;
		});
		var max = list[0];
		var max2 = list[1];
		var output = Math.floor(X / (max + max2));
		X -= output * (max + max2);
		output *= 2;
		if(X > 0){
			X -= max;
			output++;
		}
		if(X > 0){
			X -= max2;
			output++;
		}
		myout(output);
	}
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    for (let i = 0; i < t; i++) {
        const [n, h] = lines[l++].trim().split(' ').map(Number)
        const arr = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, h, arr))
    }
// })()
})

function solve(n, h, arr) {
    const [x, y] = arr.sort((a, b) => b - a)
    const k = Math.floor(h / (x + y))
    const r = h - k * (x + y)
    if (!r) {
        return k * 2
    } else if (r <= x) {
        return k * 2 + 1
    } else {
        return k * 2 + 2
    }
}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
	var t = lines[0];
	var n = 0;
	var h = 0;
    for(i = 1; i <= t * 2; i++){
        var k = lines[i].split(' ').map(Number);
        if(i % 2 == 1){
            n = k[0];
            h = k[1];
        }else{
            k = k.sort(function(a, b){return b - a});
            var x = k[0];
            var y = k[1];
            var a = 2 * Math.floor(h / (x + y)); var b = h % (x + y);
            if(b === 0){

            }else if(b % 1 === 0){
                a++;
            }else{
                a+=2;
            }
            console.log(a);
        }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
	var t = lines[0];
	var n = 0;
	var h = 0;
    for(i = 1; i <= t * 2; i++){
        var k = lines[i].split(' ').map(Number);
        if(i % 2 == 1){
            n = k[0];
            h = k[1];
        }else{
            k = k.sort(function(a, b){return b - a});
            var x = k[0];
            var y = k[1];
            var a = 2 * Math.floor(h / (x + y)); var b = h % (x + y);
            if(b === 0){

            }else if(b % 2 == 1){
                a+=2;
            }else{
                a++;
            }
            console.log(a);
        }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
	var t = lines[0];
	var n = 0;
	var h = 0;
    for(i = 1; i <= t * 2; i++){
        var k = lines[i].split(' ').map(Number);
        if(i % 2 == 1){
            n = k[0];
            h = k[1];
        }else{
            k = k.sort(function(a, b){return b - a});
            var x = k[0];
            var y = k[1];
            var a = 2 * Math.floor(h / (x + y)); var b = h % (x + y);
            if(b === 0){

            }else if(b % 2 === 0){
                a++;
            }else{
                a+=2;
            }
            console.log(a);
        }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    var e = 0;
    var hp = 0;
    var a = 0;
    var b = 0;
    for(var j = 1; j <= n * 2; j++){
        var k = lines[j].split(' ').map(Number);
        if(j % 2 == 1){
            e = k[0];
            hp = k[1];
        }else{
            k = k.sort(function(a, b){return b - a});
            a = k[0];
            b = k[1];
            if(hp % (a + b) === 0){
                console.log((hp / (a + b)) * 2);
            }else if(hp % (a + b) <= a){
                console.log(Math.floor(((hp / (a + b)) * 2) + 1));
            }else{
                console.log(Math.floor(((hp / (a + b)) * 2) + 2));
            }
        }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];

    for(j = 1; j <= n;j ++){
        var a = lines[j].split(' ').map(Number)
        console.log((a[1] - a[0]) - 1)
    }
});


"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let str = readline().trim().split("");
    if (n === 1) {
      console.log(0);
      continue;
    }
    else if(n===2){
      if(str[0]===str[1]) console.log(0);
      else console.log(1);
      continue;
    }
    let fr = new Set();
    for (let i = 0; i < n; i++) fr.add(str[i]);
    if (fr.size === n) {
      console.log(-1);
      continue;
    }
    let flag = true;
    for (let i = 0; i < n; i++) {
      if (str[i] !== str[n - i - 1]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      console.log(0);
      continue;
    }
    let res = [];
    for (let i of fr) {
      let l = 0,
        r = n - 1,
        cnt = 0,
        flag = true;
      while (l <= r) {
        if (str[l] === str[r]) {
          l++;
          r--;
        } else if (str[l] === i) {
          l++;
          cnt++;
        } else if (str[r] === i) {
          r--;
          cnt++;
        } else {
          flag = false;
          break;
        }
      }
      if (flag) res.push(cnt);
    }
    if (res.length) {
      let min = Infinity;
      for (let i = 0; i < res.length; i++) min = Math.min(res[i], min);
      console.log(min);
    } else console.log(-1);
  }
};
solve();

const acode = 'a'.charCodeAt(0);
const zcode = 'z'.charCodeAt(0);

function solve() {
   const n = Number(read());
   const str = read();
   let ans = Infinity;
   for (let i = acode; i <= zcode; i++) {
      const letter = String.fromCharCode(i);
      let currentAns = 0;
      let left = 0;
      let right = n - 1;
      while(true) {
         if (left > right) {
            break;
         }
         if (str[left] === str[right]) {
            left++;
            right--;
            continue;
         }
         if (str[left] === letter) {
            currentAns++;
            left++;
            continue;
         }
         if (str[right] === letter) {
            currentAns++;
            right--;
            continue;
         }
         currentAns = Infinity;
         break;
      }
      if (currentAns < ans) {
         ans = currentAns;
      }
   }
   write(ans === Infinity ? -1 : ans);
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function init() {
   try {
      var T;
      T = 1;
      T = Number(read());
      for (var t = 0; t < T; t++) {
         solve();
      }
   } catch (e) {
      write(e);
   }
}

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let t = rn();
	while (t--) {
		let n = rn();
		let s = rl();

		let i = 0, j = n - 1;
		while (i < j && s[i] == s[j]) {
			i++; j--;
		}

		if (i >= j) { console.log(0); continue; }

		function check(i, j, k) {
			let cnt = 0;
			while (i < j) {
				if (s[i] == s[j]) {
					i++; j--;
				}
				else {
					if (s[i] == s[k]) {
						cnt++;  i++;
					}
					else if (s[j] == s[k]) {
						cnt++; j--;
					}
					else return -1;
				}
			}
			return cnt;
		}

		let ans;
		x = check(i, j, i);
		y = check(i, j, j);
		if (x == -1 || y == -1) ans = Math.max(x ,y);
		else ans = Math.min(x, y);

		console.log(ans);
	}
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const str = lines[l++]
        output[i] = solve(n, str)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, str) {
    let ans = Infinity
    for (let i = 0; i < 26; i++) {
        const cur = isp(str, String.fromCharCode('a'.charCodeAt(0) + i))
        if (cur >= 0) {
            ans = Math.min(ans, cur)
        }
    }
    return ans === Infinity ? -1 : ans

//     let count = Array(26).fill(0)
//     for (let i = 0; i < str.length; i++) {
//         const k = str.charCodeAt(i) - 'a'.charCodeAt(0)
//         count[k]++
//     }
//     const final = count
// // console.log(final)
//     count = Array(26).fill(0)
//     for (let i = 0; i < str.length; i++) {
//         const k = str.charCodeAt(i) - 'a'.charCodeAt(0)
//         count[k]++

//         let same = 0
//         let diff
//         for (let j = 0; j < final.length; j++) {
//             if (count[j] * 2 === final[j]) {
//                 same++
//             } else {
//                 diff = Math.abs(final[j] - count[j] * 2)
//             }
//         }
//         if (same === 25) {
//             ans = Math.min(ans, diff)
//         }
//     }
}
function isp(str, ch) {
    let i = 0
    let j = str.length - 1
    let left = 0
    let right = 0
    while (i < j) {
        if (str[i] === ch && str[j] === ch) {
            i++
            j--
            left++
            right++
        } else if (str[i] === ch) {
            i++
            left++
        } else if (str[j] === ch) {
            j--
            right++
        } else {
            if (str[i] !== str[j]) return -1
            i++
            j--
        }
    }

    i = 0
    j = str.length - 1
    let ans = 0
    while (i < j) {
        if (str[i] !== str[j]) {
            if (str[i] === ch) {
                i++
                left--
            } else if (str[j] === ch) {
                j--
                right++
            } else if (left > right) {
                i++
                left--
            } else {
                j--
                right--
            }
            ans++
        } else {
            i++
            j--
        }
    }
    return ans
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let str = readline().trim().split("");
    if (n === 1) {
      console.log(0);
      continue;
    }
    let fr = new Set();
    for (let i = 0; i < n; i++) fr.add(str[i]);
    if (fr.size === n) {
      console.log(-1);
      continue;
    }
    let flag = true;
    for (let i = 0; i < n; i++) {
      if (str[i] !== str[n - i - 1]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      console.log(0);
      continue;
    }
    let res = [];
    for (let i of fr) {
      let l = 0,
        r = n - 1,
        cnt = 0,
        flag = true;
      while (l <= r) {
        if (str[l] === str[r]) {
          l++;
          r--;
        } else if (str[l] === i) {
          l++;
          cnt++;
        } else if (str[r] === i) {
          r--;
          cnt++;
        } else {
          flag = false;
          break;
        }
      }
      if (flag) res.push(cnt);
    }
    if (res.length) {
      let min = Infinity;
      for (let i = 0; i < res.length; i++) min = Math.min(res[i], min);
      console.log(min);
    } else console.log(-1);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let str = readline().trim().split("");
    let fr = new Set();
    for (let i = 0; i < n; i++) fr.add(str[i]);
    if (fr.size === n) {
      console.log(-1);
      continue;
    }
    let flag = true;
    for (let i = 0; i < n; i++) {
      if (str[i] !== str[n - i - 1]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      console.log(0);
      continue;
    }
    let res = [];
    for (let i of fr) {
      let l = 0,
        r = n - 1,
        cnt = 0,
        flag = true;
      while (l <= r) {
        if (str[l] === str[r]) {
          l++;
          r--;
        } else if (str[l] === i) {
          l++;
          cnt++;
        } else if (str[r] === i) {
          r--;
          cnt++;
        } else {
          flag = false;
          break;
        }
      }
      if (flag) res.push(cnt);
    }
    if (res.length) {
      let min = Infinity;
      for (let i = 0; i < res.length; i++) min = Math.min(res[i], min);
      console.log(min);
    } else console.log(-1);
  }
};
solve();

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let t = rn();
	while (t--) {
		let n = rn();
		let s = rl();

		let i = 0, j = n - 1;
		while (i < j && s[i] == s[j]) {
			i++; j--;
		}

		if (i >= j) { console.log(0); continue; }

		function check(i, j, k) {
			let cnt = 0;
			while (i < j) {
				if (s[i] == s[j]) {
					i++; j--;
				}
				else {
					if (s[i] == s[k]) {
						cnt++;  i++;
					}
					else if (s[j] == s[k]) {
						cnt++; j--;
					}
					else return -1;
				}
			}
			return cnt;
		}

		ans = check(i, j, i);
		if (ans == -1) ans = check(i, j, j);

		console.log(ans);
	}
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const str = lines[l++]
        output[i] = solve(n, str)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, str) {
    let ans = Infinity
    for (let i = 0; i < 26; i++) {
        const cur = isp(str, String.fromCharCode('a'.charCodeAt(0) + i))
        if (cur >= 0) {
            ans = Math.min(ans, cur)
        }
    }
    return ans === Infinity ? -1 : ans

//     let count = Array(26).fill(0)
//     for (let i = 0; i < str.length; i++) {
//         const k = str.charCodeAt(i) - 'a'.charCodeAt(0)
//         count[k]++
//     }
//     const final = count
// // console.log(final)
//     count = Array(26).fill(0)
//     for (let i = 0; i < str.length; i++) {
//         const k = str.charCodeAt(i) - 'a'.charCodeAt(0)
//         count[k]++

//         let same = 0
//         let diff
//         for (let j = 0; j < final.length; j++) {
//             if (count[j] * 2 === final[j]) {
//                 same++
//             } else {
//                 diff = Math.abs(final[j] - count[j] * 2)
//             }
//         }
//         if (same === 25) {
//             ans = Math.min(ans, diff)
//         }
//     }
}
function isp(str, ch) {
    let i = 0
    let j = str.length - 1
    let left = 0
    let right = 0
    while (i < j) {
        if (str[i] === ch && str[j] === ch) {
            i++
            j--
            left++
            right++
        } else if (str[i] === ch) {
            i++
            left++
        } else if (str[j] === ch) {
            j--
            right++
        } else {
            if (str[i] !== str[j]) return -1
            i++
            j--
        }
    }

    i = 0
    j = str.length - 1
    let ans = 0
    while (i < j) {
        if (str[i] !== str[j]) {
            if (left > right) {
                i++
                left--
            } else {
                j--
                right--
            }
            ans++
        } else{
            i++
            j--
        }
    }
    return ans
}


    var limit = parseInt(readline());
    var alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
                    'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
                    'w', 'x', 'y', 'z'];
    for (var i = 0; i < limit; i++)
    {
        var codeLength = parseInt(readline()) - 1;
        var codeNum = readline();
        var result = "";
        while (codeLength >= 0)
        {
            var current = parseInt(codeNum[codeLength]);
            if (current !== 0)
            {
                result = alphabets[current-1] + result;
            }
            else
            {
                codeLength -= 2;
                var newCodeNum = codeNum[codeLength] + codeNum[codeLength+1];
                var newCurrent = parseInt(newCodeNum);
                result = alphabets[newCurrent-1] + result;
            }
            codeLength--;
        }
        print(result);
    }

'use strict';

var fs = require('fs');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);

function solve(read) {
  const rn = () => Number(read());
  const n = rn();
  const s = read();
  let res = [];
  for (let i = n - 1; i >= 0; i--) {
    if (s[i] === '0') {
      res.push(String.fromCharCode(Number(s.slice(i - 2, i)) + 96));
      i -= 2;
    } else {
      res.push(String.fromCharCode(Number(s.slice(i, i + 1)) + 96));
    }
  }
  return res.reverse().join('');
}

function main(r) {
  try {
    let t = Number(r());
    let res = new Array(t);
    for (let i = 0; i < t; i++) {
      var _solve;
      const s = (_solve = solve(r)) !== null && _solve !== void 0 ? _solve : '';
      if (t < 100) {
        process.stdout.write(s.toString());
        process.stdout.write('\n');
      } else {
        res[i] = s;
      }
    }
    if (t >= 100) {
      return res.join('\n');
    } else {
      return '';
    }
  } catch (error) {
    console.log(error);
  }
}

const inputs = fs__default["default"].readFileSync(0, 'utf-8').split('\n');
void function () {
  const read = ((i = 0) => () => inputs[i++])();
  const output = main(read);
  process.stdout.write(output);
}();

function numberToLetter(num) {
	return (num + 9).toString(36)
}

function foo(str) {

  	var i = 0
    var result = ''

    while(i < str.length) {
    	if(str[i + 2] === '0' && str[i + 3] !== '0') {
          result += numberToLetter(Number(str[i] + str[i+1]))
          i += 3
        }
      	else {
        	result += numberToLetter(Number(str[i]))
          	i++
        }
    }

  	return result
}

var count = readline();

var inp;
var size;

for(var i = 0 ; i < count ; i++) {
    readline();
    inp = readline();
    print(foo(inp));

}

var t = +readline()

for (var i=0; i<t; i++) {

    var str_len = readline()
    var str = readline()

    var j = str.length - 1
    var ans = ""
    var ref = "0abcdefghijklmnopqrstuvwxyz"

    while (j >= 0) {
        var num = str[j]
        if (str[j] == "0") {
            num = Number(str[j-2] + str[j-1])
            j -= 2
        }
        j--
        var char = ref[num]
        ans = char + ans
    }
    print(ans)
}

var t = +readline();

for(var i = 0; i< t; i ++) {

      var nums = [];
    var arr = readline()
    var str = readline()
    print(TwoElevators(str))

}

function TwoElevators(str){
       var list = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];

    var newstr = '';

    for(var i = str.length -1; i >= 0; i--){
        if (str[i] == '0'){
            var num = str[i-2] + str[i-1]
            newstr = list[+num-1] + newstr;
            i -= 2
        }else {
            var num2 = str[i]
            newstr = list[+num2-1] + newstr;
        }
    }

    return newstr;
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", (_) => {
  inputString = inputString.trim().split("\n").map((string) => {
    return string.trim();
  });
  main();
});
function readline() {
  return inputString[currentLine++];
}
function main() {
  let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
  let n = readline();
  for (let k = 0; k < n; k++) {
    var o = readline();
    var splittedSTR = readline().trim().split('');
    var output = [];
    for (var i = 0; i < o; i++) {
      if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
        splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
        splittedSTR.splice(i + 1, 1)
        splittedSTR.splice(i - 1, 1)
      }
      if (o - i == 1) {
        for (var j = 0; j < splittedSTR.length; j++) {
          output.push(Alpha[splittedSTR[j] - 1])
          if (output.length == splittedSTR.length) {
            console.log(output.join(''));
          }
        }
      }
    }
  }
}

"use strict";

const fs = require("fs");
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", function (inputStdin) {
  inputString += inputStdin;
});

process.stdin.on("end", function () {
  inputString = inputString.split("\n");
  main();
});

function readLine() {
  return inputString[currentLine++];
}

/*
 * Complete the 'decodeString' function below.
 *
 * The function is expected to return an INTEGER.
 * The function accepts 2D_INTEGER_ARRAY arr as parameter.
 */

function decodeString(arr) {
  // Write your code here
  const dict = [
    "a",
    "b",
    "c",
    "d",
    "e",
    "f",
    "g",
    "h",
    "i",
    "j",
    "k",
    "l",
    "m",
    "n",
    "o",
    "p",
    "q",
    "r",
    "s",
    "t",
    "u",
    "v",
    "w",
    "x",
    "y",
    "z",
  ];

  for (let i = 0; i < arr.length; i++) {
    const string = arr[i].toString().split("");
    const stringLength = string.length;
    let text = "";
    let j = 0;
    while (j < string.length) {
      let posPlus2 = string[j + 2];
      let posPlus3 = string[j + 3];
      if (
        j + 2 < stringLength &&
        Number(posPlus2) === 0 &&
        ((j + 3 < stringLength && Number(posPlus3) !== 0) ||
          j + 3 >= stringLength)
      ) {
        const pos = string[j] + string[j + 1];
        text += dict[Number(pos - 1)];

        j += 3;
      } else {
        const pos = string[j];
        text += dict[Number(pos - 1)];
        j += 1;
      }
    }
    console.log(text);
  }
}

function main() {
  const n = parseInt(readLine().trim());
  let arr = Array(n);
  for (let i = 0; i < n * 2; i++) {
    let text = readLine().replace(/\s+$/g, "").split(" ");
    if (i % 2 === 1) {
      arr[Math.floor(i / 2)] = text.map((arrTemp) => arrTemp.toString())[0];
    }
  }

  const result = decodeString(arr);
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let currentLine = 0;
let inputString = "";

process.stdin.on("data", (raw_data) => {
  inputString += raw_data;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

function readInt() {
  return inputString[currentLine++];
}

function readString() {
  return inputString[currentLine++];
}

function readArrayInt() {
  return inputString[currentLine++].split(" ").map(Number);
}

function readArray() {
  return inputString[currentLine++].split(" ");
}

function main() {
  const T = readInt();

  for (let i = 0; i < T; ++i) {
    const n = readInt();
    const str = readString();

    let count = 0;
    let ans = "";
    let asd = 0;
    while (count < n) {
      //   console.log(str.slice(count + 2, count + 4), "(((((((((");
      if (str.slice(count + 2, count + 4) == "00") {
        asd = str[count];
        count++;
      } else if (count < n - 2 && str[count + 2] == "0") {
        asd = str.slice(count, count + 2);
        count += 2;
      } else {
        asd = str[count];
        count++;
      }

      ans += String.fromCharCode(+asd + 96);
      ans = ans.replace("`", "");
      //   console.log(asd, String.fromCharCode(+asd + 96), "after");
    }
    console.log(ans);
  }
}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

// function print(x) {
//   console.log(x);
// }
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********
function main() {
  let alphabet = "abcdefghijklmnopqrstuvwxyz";
  let arr = [];
  let TC = readline();
  for (let m = 0; m < TC; m++) {
    let res = "";
    let stringLeng = readline();
    let str = "" + readline();
    for (let i = stringLeng - 1; i + 1; i--) {
      if (str[i] != 0) res += alphabet[str[i] - 1];
      else {
        let jam = str[i - 1] + str[i - 2];
        jam = jam.split("").reverse().join("");
        res += alphabet[jam - 1];
        i--;
        i--;
      }
    }
    res = res.split("").reverse().join("");
    arr.push(res);
  }
  arr = arr.join("\n");
  console.log(arr);
}

// Author: shubh_singh
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let currentLine = 0;
let inputString = "";

process.stdin.on("data", (raw_data) => {
  inputString += raw_data;
});

process.stdin.on("end", (_) => {
  if(!inputString) {
    console.warn("Input file is empty.");
    return;
  }
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

readInt = () => {
  return Number(inputString[currentLine++]);
}

readString = () => {
  return inputString[currentLine++];
}

readArrayInt = () => {
  return inputString[currentLine++].split(" ").map(Number);
}

readArray = () => {
  return inputString[currentLine++].split(" ");
}

// Solve
solve = () => {
  let n = readInt();
  let s = readString();
  let i = n-1;
  let res = "";
  while(i >= 0) {
    if(s[i] == '0') {
      let val = parseInt(s[i-2]+s[i-1]);
      let code = String.fromCharCode(val+96);
      res += code;
      i -= 3;
    }else {
      let code = String.fromCharCode(parseInt(s[i])+96);
      res += code;
      i--;
    }
  }

  console.log(res.split("").reverse().join(""));
}

main = () => {
    let t = readInt();
    while(t--)
      solve();
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((string) => string.trim());

  main();
});

function main() {
  const testCases = inputString[0];

  for (let i = 2; i <= testCases * 2; i += 2) {
    const nums = inputString[i].split("").map((s) => Number(s));

    const answer = nums
      .reduce((acc, cur, ix, arr) => {
        if (cur === 0 && arr[ix + 1] !== 0) {
          const n = Number(acc[acc.length - 2] + "" + acc[acc.length - 1]);
          acc = acc.slice(0, -2);
          acc.push(n);
        } else acc.push(cur);

        return acc;
      }, [])
      .map((n) => String.fromCharCode(n + 96))
      .join("");

    console.log(answer);
  }
}

/*
** Template
*/

// Common Template Starts //
//*
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
    inputString += inputStdin;
});

process.stdin.on("end", (_) => {
    inputString = inputString
        .trim()
        .split("\n")
        .map((string) => {
            return string.trim();
        });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Common Template Ends //

const getDictionary = () => {
    let dict = []
    for (let i = 1; i <= 26; i++) {
        let d = {
            'letter': String.fromCharCode(97 + (i - 1)),
            'value': i,
        }
        dict.push(d)
    }

    return dict
}

function getResult(n, enc, dict) {
    let dec = ''

    enc = enc.split('').map(Number)

    if (n == 1) return dict.find(r => r.value == enc[0])['letter']
    if (n == 2) return dict.find(r => r.value == enc[0])['letter'] + dict.find(r => r.value == enc[1])['letter']

    let dis = []

    let i = n - 1
    while (i >= 0) {
        if (enc[i] != 0) dis.push(enc[i].toString())
        else {
            let temp = ''
            let j = i - 1
            while (j >= (i - 2)) {
                temp += enc[j].toString()
                j--
            }
            dis.push(temp.split('').reverse().join(''))
            i = j + 1
        }
        i--
    }

    dis.reverse().forEach(d => {
        dec += dict.find(r => r.value == parseInt(d))['letter']
    })

    return dec
}

function main() {
let dict = getDictionary()
    let testCases = parseInt(readline())
    while (testCases--) {
        let n = parseInt(readline())
        let enc = readline()
        console.log( getResult(n, enc, dict) )
    }
}

//*/

// console.clear()
// let n = 0
// let enc = 0
// let dict = getDictionary()

// n = 6
// enc = '315045'
// console.log( getResult(n, enc, dict) )

// n = 4
// enc = '1100'
// console.log( getResult(n, enc, dict) )

// n = 7
// enc = '1213121'
// console.log( getResult(n, enc, dict) )

// n = 6
// enc = '120120'
// console.log( getResult(n, enc, dict) )

// n = 18
// enc = '315045615018035190'
// console.log(getResult(n, enc, dict))

// n = 7
// enc = '1111110'
// console.log( getResult(n, enc, dict) )

// n = 7
// enc = '1111100'
// console.log( getResult(n, enc, dict) )

// n = 5
// enc = '11111'
// console.log( getResult(n, enc, dict) )

// n = 4
// enc = '2606'
// console.log( getResult(n, enc, dict) )

// process.exit(1)

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const str = lines[l++]
        output[i] = solve(n, str)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, str) {
    let i = n - 1
    const r = []
    while (i >= 0) {
        if (str[i] === '0') {
            r.unshift(ch(+str.slice(i - 2, i)))
            i -= 3
        } else {
            r.unshift(ch(+str[i]))
            i--
        }
    }
    return r.join('')
}
function ch(i) {
    const a = 'a'.charCodeAt(0)
    return String.fromCharCode(a + i - 1)
}

let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = -1, f;
process.stdin.on('data', function (data) {
  var splittedSTR = data.toString().trim().split('')
  let output = [];
  if (splittedSTR.length == 1) {
    if (f == undefined) {
      f = data.toString().trim();
    } else {
    }
    return;
  }
  for (var i = 0; i < splittedSTR.length; i++) {
    if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
      splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
      splittedSTR.splice(i + 1, 1)
      splittedSTR.splice(i - 1, 1)
    }
  }
  for (var i = 0; i < splittedSTR.length; i++) {
    output.push(Alpha[splittedSTR[i] - 1])
    if (output.length == splittedSTR.length) {
      console.log(output.join(''));
      z++
      if (z == f) {
        process.exit();
      }
    }
  }
})

let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], z = 0, f;
process.stdin.on('data', function (data) {
  var splittedSTR = data.toString().trim().split('')
  let output = [];
  if (splittedSTR.length == 1) {
    if (f == undefined) {
      f = data.toString().trim();
    } else {
    }
    return;
  }
  for (var i = 0; i < splittedSTR.length; i++) {
    if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
      splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
      splittedSTR.splice(i + 1, 1)
      splittedSTR.splice(i - 1, 1)
    }
  }
  for (var i = 0; i < splittedSTR.length; i++) {
    output.push(Alpha[splittedSTR[i] - 1])
    if (output.length == splittedSTR.length) {
      console.log(output.join(''));
      z++
      console.log(z, f);
    }
  }
  if (z == (f + 1)) {
    console.log('obj');
    process.exit();
  }
})

let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
process.stdin.on('data', function (data) {
  var splittedSTR = data.toString().trim().split('')
  let output = [];
  if (splittedSTR.length == 1) {
    return;
  }
  for (var i = 0; i < splittedSTR.length; i++) {
    if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
      splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
      splittedSTR.splice(i + 1, 1)
      splittedSTR.splice(i - 1, 1)
    }
  }
  for (var i = 0; i < splittedSTR.length; i++) {
    output.push(Alpha[splittedSTR[i] - 1])
    if (output.length == splittedSTR.length) {
      console.log(output.join(''));
    }
  }
})

let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
process.stdin.on('data', function (data) {
  var splittedSTR = data.toString().trim().split('')
  if (data.length == 1) data = data.toString().trim();
  let output = [];
  for (var i = 0; i < data; i++) {
    if (i == 0) {}
    else if (i % 2 == 0) {}
    else {
      for (var i = 0; i < splittedSTR.length; i++) {
        if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
          splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
          splittedSTR.splice(i + 1, 1)
          splittedSTR.splice(i - 1, 1)
        }
      }
      for (var i = 0; i < splittedSTR.length; i++) {
        output.push(Alpha[splittedSTR[i] - 1])
        if (output.length == splittedSTR.length) {
          console.log(output.join(''));
        }
      }
    }
  }
})

let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
process.stdin.on('data', function (data) {
  var splittedSTR = data.toString().trim().split('')
  if (data.length == 1) data = data.toString().trim();
  let output = [];
  for (var i = 0; i < data; i++) {
    if (i == 0) {}
    else if (i % 2 != 0) {}
    else {
      for (var i = 0; i < splittedSTR.length; i++) {
        if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
          splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
          splittedSTR.splice(i + 1, 1)
          splittedSTR.splice(i - 1, 1)
        }
      }
      for (var i = 0; i < splittedSTR.length; i++) {
        output.push(Alpha[splittedSTR[i] - 1])
        if (output.length == splittedSTR.length) {
          console.log(output.join(''));
        }
      }
    }
  }
})

let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
process.stdin.on('data', function (data) {
  var splittedSTR = data.toString().trim().split('')
  let output = []
  for (var i = 0; i < splittedSTR.length; i++) {
    if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
      splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
      splittedSTR.splice(i + 1, 1)
      splittedSTR.splice(i - 1, 1)
    }
  }
  for (var i = 0; i < splittedSTR.length; i++) {
    output.push(Alpha[splittedSTR[i] - 1])
    if (output.length == splittedSTR.length) {
      console.log(output.join(''));
    }
  }
})

let Alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
process.stdin.on('data', function (data) {
  var splittedSTR = data.toString().trim().split('')
  let output = []
  for (var i = 0; i < splittedSTR.length; i++) {
    if (splittedSTR[i + 1] == 0 && splittedSTR[i + 2] != 0) {
      splittedSTR[i] = `${splittedSTR[i - 1] + splittedSTR[i]}`;
      splittedSTR.splice(i + 1, 1)
      splittedSTR.splice(i - 1, 1)
    }
  }
  console.log(splittedSTR);
  for (var i = 0; i < splittedSTR.length; i++) {
    output.push(Alpha[splittedSTR[i] - 1])
    if (output.length == splittedSTR.length) {
      console.log(output.join(''));
    }
  }
})

"use strict";

const fs = require("fs");
process.stdin.resume();
process.stdin.setEncoding("utf-8");

let inputString = "";
let currentLine = 0;

process.stdin.on("data", function (inputStdin) {
  inputString += inputStdin;
});

process.stdin.on("end", function () {
  inputString = inputString.split("\n");
  main();
});

function readLine() {
  return inputString[currentLine++];
}

/*
 * Complete the 'decodeString' function below.
 *
 * The function is expected to return an INTEGER.
 * The function accepts 2D_INTEGER_ARRAY arr as parameter.
 */

function decodeString(arr) {
  // Write your code here
  const dict = [
    "a",
    "b",
    "c",
    "d",
    "e",
    "f",
    "g",
    "h",
    "i",
    "j",
    "k",
    "l",
    "m",
    "n",
    "o",
    "p",
    "q",
    "r",
    "s",
    "t",
    "u",
    "v",
    "w",
    "x",
    "y",
    "z",
  ];
  let result = [];
  for (let i = 0; i < arr.length; i++) {
    const string = arr[i].toString().split("");
    const stringLength = string.length;
    result[i] = [""];
    let j = 0;
    while (j < string.length) {
      let posPlus2 = string[j + 2];
      let posPlus3 = string[j + 3];
      if (
        j + 2 < stringLength &&
        Number(posPlus2) === 0 &&
        ((j + 3 < stringLength && Number(posPlus3) !== 0) ||
          j + 3 >= stringLength)
      ) {
        const pos = string[j] + string[j + 1];
        result[i] += dict[Number(pos - 1)];

        j += 3;
      } else {
        const pos = string[j];
        result[i] += dict[Number(pos - 1)];
        j += 1;
      }
    }
  }
}

function main() {
  const n = parseInt(readLine().trim());
  let arr = Array(n);
  for (let i = 0; i < n * 2; i++) {
    let text = readLine().replace(/\s+$/g, "").split(" ");
    if (i % 2 === 1) {
      arr[Math.floor(i / 2)] = text.map((arrTemp) => arrTemp.toString())[0];
    }
  }

  const result = decodeString(arr);
  console.log("result:", result);
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");

let currentLine = 0;
let inputString = "";

process.stdin.on("data", (raw_data) => {
  inputString += raw_data;
});

process.stdin.on("end", (_) => {
  inputString = inputString
    .trim()
    .split("\n")
    .map((line) => {
      return line.trim();
    });
  main();
});

function readInt() {
  return inputString[currentLine++];
}

function readString() {
  return inputString[currentLine++];
}

function readArrayInt() {
  return inputString[currentLine++].split(" ").map(Number);
}

function readArray() {
  return inputString[currentLine++].split(" ");
}

function main() {
  const T = readInt();

  for (let i = 0; i < T; ++i) {
    const n = readInt();
    const str = readString();

    let count = 0;
    let ans = "";
    while (count < n) {
      let asd = 0;
      //   console.log(str[count]);
      if (count < n - 2 && str[count + 2] == "0") {
        asd = str[count] + str[count + 1];
        count += 2;
      } else {
        asd = str[count];
        count++;
      }

      if (asd != "0") {
        ans += String.fromCharCode(+asd + 96);
      }
    }
    console.log(ans);
  }
}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

// function print(x) {
//   console.log(x);
// }
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********
function main() {
  let alphabet = "abcdefghijklmnopqrstuvwxyz";
  let arr = [];
  let TC = readline
  for (let m = 0; m < TC; m++) {
    let res = "";
    let stringLeng = readline();
    let str = readline();
    for (let i = stringLeng - 1; i + 1; i--) {
      if (str[i] != 0) res += alphabet[str[i] - 1];
      else {
        let jam = str[i - 1] + str[i - 2];
        jam = jam.split("").reverse().join("");
        res += alphabet[jam - 1];
        i--;
        i--;
      }
    }
    res = res.split("").reverse().join("");
    arr.push(res);
  }
  arr = arr.join("\n");
  console.log(arr);
}


var t = parseInt(readline());
while(t--)
{
	var ar = readline().split(' ').map(x => +x);
	var n = ar[0];
	var k = ar[1];
	var row = readline().split(' ').map(x => +x);
	var low = 0,high = 100000000000,ans = -1;
	while(low<=high)
	{
		var mid = (low + high)/2;
		mid = Math.floor(mid);
		var sum = row[0] + mid;
		var chk = 1;
		for(var i=1;i<n;i++)
		{
			if(row[i] * 100 > sum*k)   chk = 0;
			sum += row[i];
		}
		if(chk)
		{
			ans = mid;
			high = mid - 1;
		}
		else low = mid + 1;
	}
	print(ans);
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		const [n, k] = rna();
		const p = rna();

		let ans = 0;
		let psum = p[0];
		for (let i = 1; i < n; i++) {
			ans = Math.max(ans, Math.max(0, Math.ceil(100 * p[i] / k - psum)));
			psum += p[i];
		}

		console.log(ans);
	}
}

var limit = parseInt(readline());
    for (var i = 0; i < limit; i++) {
        var caseConstraints = readline().split(" ");
        var caseLength = parseInt(caseConstraints[0]);
        var inflationLimit = parseInt(caseConstraints[1]);
        var caseArray = readline().split(" ");
        var caseIntArray = new Array();
        var total = 0;
        for (var j = 0; j < caseLength; j++) {
            var value = parseInt(caseArray[j]);
            if (j !== caseLength - 1) {
                total += value;
            }
            caseIntArray.push(value);
        }
        var addition = 0;
        var rightSide = inflationLimit / 100;
        for (var j = caseLength - 1; j > 0; j--) {
            if (j < caseLength - 1) {
                total -= caseIntArray[j];
            }
            var leftSide = caseIntArray[j] / total;
            if (leftSide > rightSide) {
                var newTotal = Math.ceil(caseIntArray[j] * 100 / inflationLimit);
                addition += newTotal - total;
                total = newTotal;
            }
        }
        print(addition);
    }

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();
    var answer = []

    // console.log(Number(x))
    // 1 1 7
    // 6 9, 15, 18
    Array(Number(x)).fill(1).map((t, i) => {
        var [n, k] = readline().split(' ').map(x => Number(x));
        var sum = []
        var array = readline().split(' ').map((x, i) => {
            if (i === 0) sum.push(Number(x))
            if (i > 0)sum.push(sum[i - 1] + Number(x))

            return Number(x)
        });
        var answer = 0
        // console.log(sum)
        for (var i = n - 1; i > 0; i--) {
            // console.log(array[i], sum[i - 1])
            sum[i-1] = sum[i-1] + answer
            var number = Math.ceil(array[i] * 100 / k) - sum[i - 1]
            // console.log(number)
            if (number > 0) {
                answer += number
            }
            // console.log(sum)
        }
        console.log(answer)

    })
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();
    var answer = []

    // console.log(Number(x))
    // 1 1 7
    // 6 9, 15, 18
    Array(Number(x)).fill(1).map((t, i) => {
        var [n, k] = readline().split(' ').map(x => Number(x));
        var sum = []
        var array = readline().split(' ').map((x, i) => {
            if (i === 0) sum.push(Number(x))
            if (i > 0)sum.push(sum[i - 1] + Number(x))

            return Number(x)
        });
        var answer = 0
        for (var i = n - 1; i > 0; i--) {
            // console.log(array[i], sum[i - 1])
            var number = Math.ceil(array[i] * 100 / k) - sum[i - 1]
            // console.log(number)
            if (number > 0) answer += number
        }
        console.log(answer)

    })
}