import itertools

z = input().split()
z = [ int(x) for x in z]
broken = []
for i in range(z[1]):
    broken.append(input())

max_step = z[0] 
def steps(cand):
  tmp = []
  for j in range(len(cand)):
    tmp.append(sum(cand[:j+1]))
  return tmp

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

count = 0
all_count = 0

for i in range(int(max_step/2+0.5), max_step+1):
    #iは段の数
    #i = 5  1 = 0 ,2 = 5
    #i = 10 1 = 10, 2 = 0
    # 1 ... (i - 5) * 2  2 ... -1 * i + 10
    #1... (i - max_step/2)  2...-1 * i  + max_step
    num_1 =int( (i - max_step/2)*2)
    num_2 = (-1 * i + max_step)
    template_steps = []
    for j in range(num_1):
        template_steps.append(1)
    for j in range(num_2):
        template_steps.append(2)
    #print(template_steps)
    
    index = list(range(len(template_steps)))
    arrays = []
    for indexes in list(itertools.permutations(index)):
      arrays.append([template_steps[x] for x in indexes])
    #print(arrays)
#    arrays = get_unique_list(arrays)
    arrays = list(map(list, set(map(tuple, arrays))))
    
    for j in range(len(arrays)):
      all_count += 1
      for b in broken:
        if list(steps(arrays[j])).count(int(b)) > 0:
          #arrays[j] = [0,0]
          count += 1
          break  
print((all_count - count)%1000000007)