# -*- coding: utf-8 -*- M = 1000003 def rec_pow(x,n): if n == 0: return 1 elif n%2 == 0: return (rec_pow(x*x%M, n//2)) else: return (rec_pow(x*x%M, n//2) * x) % M xN = list(map(int, input().split())) a = list(map(int, input().split())) x = xN[0] N = xN[1] ans = 0 for e in a: ans += rec_pow(x, e) % M ans %= M print(ans)