#T725. 【NOIP2002-J2】选数

【NOIP2002-J2】选数

Description

Given n integers x1, x2, ..., xn, and an integer k (k < n). By selecting any k integers from the n integers and summing them, a series of sums can be obtained. For example, when n=4, k=3, and the 4 integers are 3, 7, 12, and 19, all possible combinations and their sums are:
3 + 7 + 12 = 22  3 + 7 + 19 = 29  7 + 12 + 19 = 38  3 + 12 + 19 = 34.

Now, you are required to calculate how many of these sums are prime numbers.
In the example above, there is only one sum that is a prime number: 3 + 7 + 19 = 29.

Input Format

Input is read from the keyboard in the following format:

n , k (1 ≤ n ≤ 20,k < n)

x1, x2, ..., xn (1 ≤ xi ≤ 5000000)

Output Format

Output is displayed on the screen in the following format:

An integer (the number of valid combinations).

```input1 4 3 3 7 12 19 ``` ```output1 1 ``` ## Source

NOIP2002-J2

(Note: NOIP stands for National Olympiad in Informatics in Provinces, a Chinese programming competition for high school students. The "J2" likely indicates this is the second problem from the junior division of the 2002 contest.)