import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N, K = map(int, readline().split()) A = np.array(read().split(), np.int64) if K == 0: print(0) print(0) exit() mu = ((1 << K) - 1) * N << K - 1 sigma = 0 for i in range(K): x = int(np.sum((A >> i) & 1)) y = N - x sigma += (1 << i + i) * (x - y) ** 2 sigma <<= K + K - 2 MOD = 10 ** 9 + 9 print(mu % MOD) print(sigma % MOD)