1042A.md (1981B)
1 Source: https://codeforces.com/problemset/problem/1042/A 2 3 A. Benches 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 There are $n$ benches in the Berland Central park. It is known that $a_i$ people are currently sitting on the $i$-th bench. Another $m$ people are coming to the park and each of them is going to have a seat on some bench out of $n$ available. 22 23 Let $k$ be the maximum number of people sitting on one bench after additional $m$ people came to the park. Calculate the minimum possible $k$ and the maximum possible $k$. 24 25 Nobody leaves the taken seat during the whole process. 26 27 Input 28 29 The first line contains a single integer $n$ $(1 \le n \le 100)$ — the number of benches in the park. 30 31 The second line contains a single integer $m$ $(1 \le m \le 10\,000)$ — the number of people additionally coming to the park. 32 33 Each of the next $n$ lines contains a single integer $a_i$ $(1 \le a_i \le 100)$ — the initial number of people on the $i$-th bench. 34 35 Output 36 37 Print the minimum possible $k$ and the maximum possible $k$, where $k$ is the maximum number of people sitting on one bench after additional $m$ people came to the park. 38 39 Examples 40 41 Input 42 43 ``` 44 4 45 6 46 1 47 1 48 1 49 1 50 ``` 51 52 Output 53 54 ``` 55 3 7 56 ``` 57 58 Input 59 60 ``` 61 1 62 10 63 5 64 ``` 65 66 Output 67 68 ``` 69 15 15 70 ``` 71 72 Input 73 74 ``` 75 3 76 6 77 1 78 6 79 5 80 ``` 81 82 Output 83 84 ``` 85 6 12 86 ``` 87 88 Input 89 90 ``` 91 3 92 7 93 1 94 6 95 5 96 ``` 97 98 Output 99 100 ``` 101 7 13 102 ``` 103 104 Note 105 106 In the first example, each of four benches is occupied by a single person. The minimum $k$ is $3$. For example, it is possible to achieve if two newcomers occupy the first bench, one occupies the second bench, one occupies the third bench, and two remaining — the fourth bench. The maximum $k$ is $7$. That requires all six new people to occupy the same bench. 107 108 The second example has its minimum $k$ equal to $15$ and maximum $k$ equal to $15$, as there is just a single bench in the park and all $10$ people will occupy it.