A. Benches

A. Benches

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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

Copy

4
6
1
1
1
1

output

Copy

3 7

input

Copy

1
10
5

output

Copy

15 15

input

Copy

3
6
1
6
5

output

Copy

6 12

input

Copy

3
7
1
6
5

output

Copy

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.

AC代码(最多的可能一定是人数最多的椅子上的人+m, 最少的可能要分类讨论

1、假设所有的凳子都和人数最多的那个凳子做一样的人数这个和>m那么最少的可能是人数最多的椅子上的人数

2、所有凳子都做和人数最多的拿个凳子一样的人仍然坐不下m个人那就把剩下的人平均分配再找出人数最多的凳子)

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, m, a[120], i, maxi = 0, sm = 0, mini;
    scanf("%d %d",&n, &m);
    int f = m;
    for(i = 0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]>maxi)
            maxi = a[i];
    }
    for(i = 0;i<n;i++)
    {
        sm = sm+maxi-a[i];
    }
    if(sm>=m) mini = maxi;
    else
    {
        m = m-sm;
        int k = m%n;
        m = m/n;
        if(k>0) m++;
        mini = maxi+m;
    }
    maxi = maxi+f;
    printf("%d %d\n",mini, maxi);
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值