- Time limit: 1.00 s
- Memory limit: 512 MB
A binary tree has levels and the tree is perfect, i.e., each node has two children (except for the leaves). The nodes of the tree are numbered so that the root is and the left and right children of a node are and . In addition, the tree has forbidden edges that we may not traverse.
We construct a graph based on the tree by mirroring it in the leaves. How many paths are there such that the path starts and ends in the root of the original tree, it contains at least one edge and does not traverse any edge more than once?
For example, the following graph has such paths:
Input
The first input line has two integers and : the height of the tree and the number of forbidden edges.
After this, there are lines that contain integers . An integer indicates that we may not use the edge between the nodes and . Each such edge is given only once.
Output
Print one integer: the number of distinct paths modulo .
Example
Input:
4 3 10 5 13
Output:
12
The image corresponds to the example. The forbidden edges are red.