The cows' slimming diet has left Farmer John with extra hay so he has decided to hold an auction to reduce his inventory. He has N (1 <= N <= 1,000) identical lots (each of about 100 bales) of hay; his potential customers comprise M (1 <= M <= 1,000) other farmers in the area.
Each farmer i tells Farmer John how much he is willing to pay P_i (1 <= P_i <= 1,000,000) for a lot of hay. Each of the farmers wishes to purchase a single lot of hay.
To make sure the other farmers do not get jealous of each other, Farmer John decides that he must sell the lots of hay at a fixed price to each customer who is willing to pay at least that price; the rest will decline the purchase.
Help Farmer John determine the smallest price he should set on a lot of hay to maximize the amount of money he makes.
* Line 1: Two space-separated integers: N and M
* Lines 2..M+1: Line i+1 contains a single integer: P_i
* Line 1: Two space-separated integers: the smallest price that Farmer John should choose to maximize his revenue and the amount of money he takes in.