def calc(x, n): if n == 0: return 1 if n % 2 == 1: return (x * calc(x, n-1)) % 1000003 p = (calc(x, n/2)) % 1000003 return (p * p) % 1000003 x, N = map(int, raw_input().split()) a = map(int, raw_input().split()) sum = 0 for i in range(0, N): sum = (sum + calc(x, a[i])) % 1000003 print sum