MOD = 10 ** 6 + 3 X, N = map(int, input().split()) A = list(map(int, input().split())) ans = 0 for a in A: ans += pow(X, a) ans %= MOD print(ans)