const input = require('fs').readFileSync('/dev/stdin', 'utf8'); const [H, N] = input.split('\n')[0].split(/\s/).map(v => Number(v)); const arrH = input.split('\n').slice(1, N).map(v => Number(v)).sort((a, b) => a - b).reverse(); let COUNT = 1; console.log(arrH); for (i in arrH) { console.log(arrH[i],i); if (arrH[i] < H) { console.log(arrH[i] , H); COUNT += Number(i); break; } } switch(COUNT){ case 1: console.log('1st'); break; case 2: console.log('2nd'); break; case 3: console.log('3rd'); break; default: console.log(COUNT + 'th'); break; }