n = int(input()) m = int(input()) A = list(input().split()) print(sum(map(lambda x: 2 ** (n - len(x)), A)))