Codeforces Round 772 (Div. 2)
D
Infinite Set
Codeforces
1800
原题
← CE →
翻译中…

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:

翻译中…
  1. $x = a_i$ for some $1 \leq i \leq n$.
  2. $x = 2y + 1$ and $y$ is in $S$.
  3. $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 $2^p$. Since this number may be too large, print it modulo $10^9 + 7$.

翻译中…

Input

翻译中…

The first line contains two integers $n$ and $p$ $(1 \leq n, p \leq 2 \cdot 10^5)$.

翻译中…

The second line contains $n$ integers $a_1,a_2,\ldots,a_n$ $(1 \leq a_i \leq 10^9)$.

翻译中…

It is guaranteed that all the numbers in $a$ are distinct.

翻译中…

Output

翻译中…

Print a single integer, the number of elements in $S$ that are strictly smaller than $2^p$. Remember to print it modulo $10^9 + 7$.

翻译中…

Note

翻译中…

In the first example, the elements smaller than $2^4$ are $\{1, 3, 4, 6, 7, 9, 12, 13, 15\}$.

翻译中…

In the second example, the elements smaller than $2^7$ are $\{5,11,20,23,39,41,44,47,79,80,83,89,92,95\}$.

翻译中…

样例

Input #1
2 4
6 1
Output #1
9
InputCopy OutputCopy
Input #2
4 7
20 39 5 200
Output #2
14
InputCopy OutputCopy
Input #3
2 200000
48763 1000000000
Output #3
448201910
InputCopy OutputCopy
题目信息
题号
1635D
时间限制
2 s
内存限制
256 MB
标签
位运算
动态规划
数学
矩阵
数论
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。