x, a= [ int(v) for v in input().split() ] powlist = sorted([ int(v) for v in input().split() ]) mod = 1000003 def calculated_powlist(x,y): anslist = [ 1 for i in range(y+1) ] for i in range(y): anslist[i+1] = (anslist[i]*x) % mod return anslist callist = calculated_powlist(x,max(powlist)) s = 0 for i in powlist: s += callist[i] print(s%mod)