x,n=map(int,input().split()) a=list(map(int,input().split())) v=0 for i in a: v+=x**i%1000003 print(v)