# Turn the pokers

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 394 Accepted Submission(s): 140

Problem Description

During summer vacation,Alice stay at home for a long time, with nothing to do. She went out and bought m pokers, tending to play poker. But she hated the traditional gameplay. She wants to change. She puts these pokers face down, she decided to flip poker n times, and each time she can flip Xi pokers. She wanted to know how many the results does she get. Can you help her solve this problem?

Input

The input consists of multiple test cases. Each test case begins with a line containing two non-negative integers n and m(0<n,m<=100000). The next line contains n integers Xi(0<=Xi<=m).

Output

Output the required answer modulo 1000000009 for each test case, one per line.

Sample Input

3 4 3 2 3 3 3 3 2 3

Sample Output

8 3

Hint

For the second example: 0 express face down,1 express face up Initial state 000 The first result:000->111->001->110 The second result:000->111->100->011 The third result:000->111->010->101 So, there are three kinds of results(110,011,101)

Author

FZU

Source

2014 Multi-University Training Contest 1

其实就是求最后状态有几个可能翻转，然后就是组合数了。 有几个翻转是连续的区间，而且奇偶性和总和是一样的。 递推求出区间，然后求解。   一开始区间是$0,0$ 递推的时候把几种情况都罗列一下，就得出了下一个区间。

------ 本文结束------
• 本文作者： kuangbin
• 本文链接： 286.html
• 版权声明： 本博客所有文章除特别声明外，均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处！
0%