2017 Revenge
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld

题目描述

Bobo has n integers .
He would like to choose some of the integers and calculate their product (the product of the empty set is defined as 1).

Bobo would like to know the number of products whose remainder divided by 2017 is r. As the exact number is too large, he only asks for the number modulo 2.

输入描述:

The input contains zero or more test cases and is terminated by end-of-file.  For each case,
The first line contains two integers n, r.
The second line contains n integers .

*
*
* The sum of n does not exceed .

输出描述:

For each case, output an integer which denotes the parity.
示例1

输入

复制
3 6
2 3 4
4 1
1 1 2016 2016

输出

复制
1
0