B. 2026新年计划

    Type: Default 1000ms 64MiB

2026新年计划

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

2026年到了,你作为活动策划负责人,需要为公司准备一场“2026 新年庆典”。

公司一共准备了 nn 个节目备选,每个节目都有一个“热度值” aia_i(正整数)。为保证活动效果,需要满足下面两个条件:

  1. 所选节目的总热度值 至少为 2026×p2026\times p
  2. 为了控制流程时长,你希望选出的节目的数量 尽可能少。

请你计算:在满足总热度值至少为 2026×p2026\times p的前提下,最少需要选多少个节目。如果无论如何总热度值都达不到2026×p2026\times p,则输出 -1。

输入格式

第一行两个整数nnpp

第二行包含 nn 个整数 a1,a2,,ana_1, a_2, …, a_n,表示每个节目的热度值。

输出格式

输出一个整数,表示在总热度值至少为 2026×p2026\times p 的前提下,最少需要选择的节目数量;若无法达到总热度值 2026×p2026\times p,则输出 -1。

输入输出样例 #1

输入 #1

5 1
500 600 700 300 1000

输出 #1

3

输入输出样例 #2

输入 #2

3 1
500 500 500

输出 #2

-1

说明/提示

数据很大,建议使用c/c++

1n1061\leq n \leq 10^6

1p1091\leq p \leq 10^9

1ai1091\leq a_i \leq 10^9

hello,2026

Not Attended
Status
Done
Rule
XCPC
Problem
5
Start at
2026-1-1 8:00
End at
2026-1-7 20:00
Duration
156 hour(s)
Host
Partic.
23