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