x, n = [int(s) for s in input().split()] a = [int(s) for s in input().split()] mod = 1000003 big = 100000 xx = [0] * (big + 1) xx[0] = 1 for e in range(1, big + 1): xx[e] = xx[e - 1] * x % mod res = 0 for ai in a: if ai > big: prod = 1 for e in range(ai // big): prod = prod * xx[big] % mod for e in range(ai % big): prod = prod * x % mod res = (res + prod) % mod else: res = (res + xx[ai]) % mod print(res)