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