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; for (i in arrH) { if (arrH[i] >= H) { COUNT++; } } 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; } console.log(input);