Problem B
Mixing Drinks
Pia is a famous bartender at the hip Stockholm night club
Supernova. One of her most impressive feats is the mixing a
series of drinks using each of the
First, Pia chooses a number of drinks to make. Each of the
drink ingredients are then lined up in front of her in order
However, not every pair of ingredients work well in a drink. For example, milk and water would not go very well together. She may not include a bad pair of ingredients in any drink.
So far, she has managed to make a different set of drinks every night. For how many nights can she mix a new set of drinks? We call two sets of drinks different if they do not consist of the exact same drinks (though they are allowed to have drinks in common).
Input
The first line of the input contains two integers
Each of the next
Output
Output a single integer, the number of nights Pia can
construct a different set of drinks. Since this number may be
large, output the remainder when divided by
Sample Input 1 | Sample Output 1 |
---|---|
5 3 1 3 4 5 2 4 |
5 |
Sample Input 2 | Sample Output 2 |
---|---|
5 0 |
16 |