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