x,N = map(int,raw_input().split()) a = map(int,raw_input().split()) k = [0 for i in xrange(max(a) + 1)] k[0] = 1 for i in xrange(1,len(k)): k[i] = k[i - 1] * x ans = 0 for i in range(N): ans += k[a[i]] ans %= 1000003 print ans