Far away, in the middle of a desert, there is a lake. Originally the lake held $F$ fish. Among the most valuable gemstones on Earth, $K$ different kinds were chosen, and each of the $F$ fish was made to swallow exactly one gem. Because $K$ may be smaller than $F$, several fish may have swallowed gems of the same kind.
As time went by, some fish ate others. One fish can eat another if and only if it is at least twice as long: fish $A$ can eat fish $B$ exactly when $L_A \ge 2 \cdot L_B$. There is no rule about when a fish decides to eat — a fish may eat several smaller fish one after another, or choose to eat none at all even when it could. When a fish eats a smaller one its own length does not change, and every gem in the smaller fish's stomach passes, undamaged, into the larger fish's stomach.
You are allowed to take a single fish out of the lake and keep all the gems currently in its stomach. Before setting out, you want to know how many different gem combinations you could obtain by catching one fish.
Write a program that, given the length of each fish and the kind of gem it originally swallowed, computes the number of different gem combinations that can end up in the stomach of some fish, modulo a given integer $M$. A combination is determined solely by how many gems of each of the $K$ kinds it contains: gems have no order, and two gems of the same kind are indistinguishable.
It is guaranteed that at least one gem of each of the $K$ kinds is present.
Print a single line containing one integer between $0$ and $M-1$ inclusive: the number of different possible gem combinations, taken modulo $M$. The value of $M$ has no meaning beyond keeping the numbers small.