There are nn benches in the Berland Central park. It is known that aiai people are currently sitting on the ii-th bench. Another mm people are coming to the park and each of them is going to have a seat on some bench out of nn available.
Let kk be the maximum number of people sitting on one bench after additional mm people came to the park. Calculate the minimum possible kk and the maximum possible kk.
Nobody leaves the taken seat during the whole process.
Input
The first line contains a single integer nn (1≤n≤100)(1≤n≤100) — the number of benches in the park.
The second line contains a single integer mm (1≤m≤10000)(1≤m≤10000) — the number of people additionally coming to the park.
Each of the next nn lines contains a single integer aiai (1≤ai≤100)(1≤ai≤100) — the initial number of people on the ii-th bench.
Output
Print the minimum possible kk and the maximum possible kk, where kk is the maximum number of people sitting on one bench after additional mm people came to the park.
Examples
Input
4
6
1
1
1
1
Output
3 7
Input
1
10
5
Output
15 15
Input
3
6
1
6
5
Output
6 12
Input
3
7
1
6
5
Output
7 13
Note
In the first example, each of four benches is occupied by a single person. The minimum kk is 33. 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 kk is 77. That requires all six new people to occupy the same bench.
The second example has its minimum kk equal to 1515 and maximum kk equal to 1515, as there is just a single bench in the park and all 1010 people will occupy it.
题目大意:
输入n,m,表示有n个椅子,一会会有m个人来,接下来n行是每个椅子上的人数,输出是m个人来了之后椅子上最少可以坐多少个人,最多可以坐多少个人。
解题思路:
最多的人数显而易见,就是m个人坐在当前人数最多的椅子上。而最少的人数,则是使所有椅子上的人数走一样多,也就是用m个人让所有椅子人数都为当前最大的人数。这样操作,就会有以下情况:
1.m个人没补完,那min就为当前的最大值
2.正好补完,min也为当前的最大值
3.补完了还有剩余,那就每个椅子依次加一,直到都补完,min为此时的最大值
AC代码:
#include<stdio.h>
#include<cstdlib>
#include<cmath>
#include<iostream>
using namespace std;
const int N=1e5+10;
int a[N];
int main()
{
int n,m,l,r,mid;
cin >> n >> m;
int ans=0,sum=0;
for(int i=0;i<n;i++)
{
cin >> a[i];
ans=ans+a[i]; //所有人数的和
sum=max(sum,a[i]);//椅子上的最大人数
}
int t=sum;
sum+=m;//最大值已求出
ans+=m;
l=ans%n;
ans=ans/n;
if(l!=0)
ans+=1;
ans=max(ans,t);
printf("%d %d\n",ans,sum);
return 0;
}