CF1635D.Infinite Set
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an array a consisting of n distinct positive integers.
Let's consider an infinite integer set S which contains all integers x that satisfy at least one of the following conditions:
- x=ai for some 1≤i≤n .
- x=2y+1 and y is in S .
- x=4y and y is in S .
For example, if a=[1,2] then the 10 smallest elements in S will be {1,2,3,4,5,7,8,9,11,12} .
Find the number of elements in S that are strictly smaller than 2p . Since this number may be too large, print it modulo 109+7 .
输入格式
The first line contains two integers n and p (1≤n,p≤2⋅105) .
The second line contains n integers a1,a2,…,an (1≤ai≤109) .
It is guaranteed that all the numbers in a are distinct.
输出格式
Print a single integer, the number of elements in S that are strictly smaller than 2p . Remember to print it modulo 109+7 .
输入输出样例
输入#1
2 4 6 1
输出#1
9
输入#2
4 7 20 39 5 200
输出#2
14
输入#3
2 200000 48763 1000000000
输出#3
448201910
说明/提示
In the first example, the elements smaller than 24 are {1,3,4,6,7,9,12,13,15} .
In the second example, the elements smaller than 27 are {5,11,20,23,39,41,44,47,79,80,83,89,92,95} .