import java.util.Scanner; public class Main { final static int mod = 1000003; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int x = scanner.nextInt(); int N = scanner.nextInt(); int[] a = new int[N]; for (int i = 0; i < N; i++) { a[i] = scanner.nextInt(); } int sum = 0; for (int i = 0; i < N; i++) { sum += myPow(x, a[i]); } System.out.println(sum % mod); } private static long myPow(int x, int i) { if (i == 0) { return 1; } if (i % 2 == 1) { return (x * myPow(x, i - 1)) % mod; } else { long s = myPow(x, i / 2); return (s * s) % mod; } } }