x,n=map(int,input().split()) a=list(map(int,input().split())) ans=0 for i in range(n): ans+=pow(x,a[i],1000003) print(ans%1000003)