EVEN SUM

0

0 votes
Problem

Find the number of different n digit numbers that can be formed using given k digits. Sum of digits of every n digits number must be even. Repetition of given k digits is allowed.

Since the answer can be very large, print it modulo 10^9+7.

Note : In the given allowed digits(k), the number of odd digits and even digits are the equal.

 

Input Format

First line contains two integers n and k.

Second line contains k distinct integers denoting the allowed digits.

 

Output Format

Print a single integer – the number of n digit numbers formed whose sum of digits is even modulo 10^9+7. 

 

Constraints

1 <= n <= (10^7)

2 <= k <= 10 

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

45 out of all the two digit numbers possible under given constraint have sum of their digits as even.

Editor Image

?