{"problem":{"name":"A. Straight «A»","description":{"content":"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 ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF810A"},"statements":[{"statement_type":"Markdown","content":"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.\n\nIn school, where Noora is studying, teachers are putting down marks to the online class register, which are integers from 1 to _k_. The worst mark is 1, the best is _k_. 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.3 is rounded to 7, but 7.5 and 7.8784 — to 8.\n\nFor instance, if Noora has marks \\[8, 9\\], then the mark to the certificate is 9, because the average is equal to 8.5 and rounded to 9, but if the marks are \\[8, 8, 9\\], Noora will have graduation certificate with 8.\n\nTo graduate with «A» certificate, Noora **has to have mark** _k_.\n\nNoora got _n_ marks in register this year. However, she is afraid that her marks are not enough to get final mark _k_. 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 1 to _k_. 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 _k_.\n\n## Input\n\nThe first line contains two integers _n_ and _k_ (1 ≤ _n_ ≤ 100, 1 ≤ _k_ ≤ 100) denoting the number of marks, received by Noora and the value of highest possible mark.\n\nThe second line contains _n_ integers _a_1, _a_2, ..., _a__n_ (1 ≤ _a__i_ ≤ _k_) denoting marks received by Noora before Leha's hack.\n\n## Output\n\nPrint a single integer — minimal number of additional marks, that Leha has to add in order to change Noora's final mark to _k_.\n\n[samples]\n\n## Note\n\nConsider the first example testcase.\n\nMaximal mark is 10, Noora received two marks — 8 and 9, so current final mark is 9. To fix it, Leha can add marks \\[10, 10, 10, 10\\] (4 marks in total) to the registry, achieving Noora having average mark equal to . Consequently, new final mark is 10. Less number of marks won't fix the situation.\n\nIn the second example Leha can add \\[5, 5, 5\\] to the registry, so that making average mark equal to 4.5, which is enough to have 5 in the certificate.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"Noora 是一所著名高中的学生。今年是她中学的最后一年——明年她将进入大学学习。然而，她必须获得一张 «A» 毕业证书才能申请一所顶尖大学。\n\n在 Noora 就读的学校中，教师们将分数记录在在线班级登记册中，分数为从 #cf_span[1] 到 #cf_span[k] 的整数。最差的分数是 #cf_span[1]，最好的是 #cf_span[k]。最终录入证书的分数是所有分数的平均值，四舍五入到最接近的整数。如果有多个可能的答案，则向上取整。例如，#cf_span[7.3] 四舍五入为 #cf_span[7]，而 #cf_span[7.5] 和 #cf_span[7.8784] 则四舍五入为 #cf_span[8]。\n\n例如，如果 Noora 的分数为 #cf_span[[8, 9]]，则证书上的分数为 #cf_span[9]，因为平均值为 #cf_span[8.5]，四舍五入为 #cf_span[9]；但如果分数为 #cf_span[[8, 8, 9]]，Noora 的证书分数将是 #cf_span[8]。\n\n为了获得 «A» 证书，Noora *必须拥有分数* #cf_span[k]。\n\n今年 Noora 已经获得了 #cf_span[n] 个分数。然而，她担心这些分数不足以获得最终分数 #cf_span[k]。Noora 决定在网上寻求帮助，黑客 Leha 立即回应了她的请求。他准备为 Noora 黑入班级登记册，并添加任意数量的额外分数，分数范围为 #cf_span[1] 到 #cf_span[k]。同时，Leha 希望他的黑客行为不被任何人发现，因此他希望添加尽可能少的额外分数。请帮助 Leha 计算他必须添加的最少分数数量，使得 Noora 的最终分数变为 #cf_span[k]。\n\n第一行包含两个整数 #cf_span[n] 和 #cf_span[k] #cf_span[(1 ≤ n ≤ 100, 1 ≤ k ≤ 100)]，分别表示 Noora 已获得的分数数量和最高可能分数。\n\n第二行包含 #cf_span[n] 个整数 #cf_span[a1, a2, ..., an] #cf_span[(1 ≤ ai ≤ k)]，表示 Leha 黑入前 Noora 获得的分数。\n\n请输出一个整数——Leha 必须添加的最少额外分数数量，以便将 Noora 的最终分数变为 #cf_span[k]。\n\n考虑第一个示例测试用例。\n\n最高分数为 #cf_span[10]，Noora 获得了两个分数 — #cf_span[8] 和 #cf_span[9]，因此当前最终分数为 #cf_span[9]。为修正此情况，Leha 可以向登记册添加分数 #cf_span[[10, 10, 10, 10]]（共 #cf_span[4] 个分数），使 Noora 的平均分数变为 。因此，新的最终分数为 #cf_span[10]。更少的分数无法解决此问题。\n\n在第二个示例中，Leha 可以向登记册添加 #cf_span[[5, 5, 5]]，使平均分数变为 #cf_span[4.5]，这足以使证书上的分数为 #cf_span[5]。\n\n## Input\n\n第一行包含两个整数 #cf_span[n] 和 #cf_span[k] #cf_span[(1 ≤ n ≤ 100, 1 ≤ k ≤ 100)]，分别表示 Noora 已获得的分数数量和最高可能分数。第二行包含 #cf_span[n] 个整数 #cf_span[a1, a2, ..., an] #cf_span[(1 ≤ ai ≤ k)]，表示 Leha 黑入前 Noora 获得的分数。\n\n## Output\n\n请输出一个整数——Leha 必须添加的最少额外分数数量，以便将 Noora 的最终分数变为 #cf_span[k]。\n\n[samples]\n\n## Note\n\n考虑第一个示例测试用例。最高分数为 #cf_span[10]，Noora 获得了两个分数 — #cf_span[8] 和 #cf_span[9]，因此当前最终分数为 #cf_span[9]。为修正此情况，Leha 可以向登记册添加分数 #cf_span[[10, 10, 10, 10]]（共 #cf_span[4] 个分数），使 Noora 的平均分数变为 。因此，新的最终分数为 #cf_span[10]。更少的分数无法解决此问题。在第二个示例中，Leha 可以向登记册添加 #cf_span[[5, 5, 5]]，使平均分数变为 #cf_span[4.5]，这足以使证书上的分数为 #cf_span[5]。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n, k \\in \\mathbb{Z}^+ $ with $ 1 \\leq n \\leq 100 $, $ 1 \\leq k \\leq 100 $.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of integers with $ 1 \\leq a_i \\leq k $ for all $ i $.  \n\nLet $ s = \\sum_{i=1}^n a_i $ be the sum of existing marks.  \nLet $ m \\in \\mathbb{Z}_{\\geq 0} $ be the number of additional marks, each equal to $ k $, to be added.  \n\nThe final average is $ \\frac{s + m \\cdot k}{n + m} $.  \n\nThe final mark is defined as the rounded value:  \n$$\n\\left\\lfloor \\frac{s + m \\cdot k}{n + m} + 0.5 \\right\\rfloor\n$$\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 100 $  \n2. $ 1 \\leq k \\leq 100 $  \n3. $ 1 \\leq a_i \\leq k $ for all $ i \\in \\{1, \\dots, n\\} $  \n\n**Objective**  \nFind the minimal $ m \\in \\mathbb{Z}_{\\geq 0} $ such that:  \n$$\n\\left\\lfloor \\frac{s + m \\cdot k}{n + m} + 0.5 \\right\\rfloor = k\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF810A","tags":["implementation","math"],"sample_group":[["2 10\n8 9","4"],["3 5\n4 4 4","3"]],"created_at":"2026-03-03 11:00:39"}}