import java.util.Scanner; public class Main_yukicoder16 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int MOD = 1000003; int x = sc.nextInt(); int n = sc.nextInt(); long ret = 0; for (int i = 0; i < n; i++) { int a = sc.nextInt(); long tmp = x; long tmp2 = 1; while (a > 0) { if (a % 2 == 1) { tmp2 = tmp2 * tmp % MOD; } tmp = tmp * tmp % MOD; a /= 2; } ret = (ret + tmp2) % MOD; } System.out.println(ret); sc.close(); } }