x,n=map(int,input().split()) L=list(map(int,input().split())) mod=10**6+3 ans=0 for i in range(n): ans+=pow(x,L[i],mod) ans%=mod print(ans%mod)