x,n=map(int,input().split()) a=list(map(int,input().split())) def pow_k(x, n): """ O(log n) """ if n == 0: return 1 K = 1 while n > 1: if n % 2 != 0: K = K * x x = x ** 2 n = (n - 1) // 2 else: x = x ** 2 n = n // 2 return (K * x)%mod dp=[0]*(max(a)+1) ans=0 mod=1000003 for i in a: ans+=pow_k(x,i) print(ans%mod)