import std.algorithm; import std.array; import std.conv; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; int readint() { return readln.chomp.to!int; } int[] readints() { return readln.split.map!(to!int).array; } void main() { auto hn = readints; int h = hn[0], n = hn[1]; auto xs = [h]; for (int i = 0; i < n - 1; i++) { xs ~= readint; } xs.sort().reverse(); auto p = xs.countUntil(h); write(p + 1); switch ((p + 1) % 10) { case 1: writeln("st"); break; case 2: writeln("nd"); break; case 3: writeln("rd"); break; default: writeln("th"); break; } }