CF810A.Straight «A»

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Noora is a student of one famous high school. It's her final year in school — she is going to study in university next year. However, she has to get an «A» graduation certificate in order to apply to a prestigious one.

In school, where Noora is studying, teachers are putting down marks to the online class register, which are integers from 11 to kk . The worst mark is 11 , the best is kk . Mark that is going to the certificate, is calculated as an average of all the marks, rounded to the closest integer. If several answers are possible, rounding up is produced. For example, 7.37.3 is rounded to 77 , but 7.57.5 and 7.87847.8784 — to 88 .

For instance, if Noora has marks [8,9][8,9] , then the mark to the certificate is 99 , because the average is equal to 8.58.5 and rounded to 99 , but if the marks are [8,8,9][8,8,9] , Noora will have graduation certificate with 88 .

To graduate with «A» certificate, Noora has to have mark kk .

Noora got nn marks in register this year. However, she is afraid that her marks are not enough to get final mark kk . Noora decided to ask for help in the internet, where hacker Leha immediately responded to her request. He is ready to hack class register for Noora and to add Noora any number of additional marks from 11 to kk . At the same time, Leha want his hack be unseen to everyone, so he decided to add as less as possible additional marks. Please help Leha to calculate the minimal number of marks he has to add, so that final Noora's mark will become equal to kk .

输入格式

The first line contains two integers nn and kk (1<=n<=100,1<=k<=100)(1<=n<=100,1<=k<=100) denoting the number of marks, received by Noora and the value of highest possible mark.

The second line contains nn integers a1,a2,...,ana_{1},a_{2},...,a_{n} (1<=ai<=k)(1<=a_{i}<=k) denoting marks received by Noora before Leha's hack.

输出格式

Print a single integer — minimal number of additional marks, that Leha has to add in order to change Noora's final mark to kk .

输入输出样例

  • 输入#1

    2 10
    8 9
    

    输出#1

    4
  • 输入#2

    3 5
    4 4 4
    

    输出#2

    3

说明/提示

Consider the first example testcase.

Maximal mark is 1010 , Noora received two marks — 88 and 99 , so current final mark is 99 . To fix it, Leha can add marks [10,10,10,10][10,10,10,10] ( 44 marks in total) to the registry, achieving Noora having average mark equal to . Consequently, new final mark is 1010 . Less number of marks won't fix the situation.

In the second example Leha can add [5,5,5][5,5,5] to the registry, so that making average mark equal to 4.54.5 , which is enough to have 55 in the certificate.

首页