import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); final int m = 1000003; 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++) { int xa = 1; for (int j = 0; j < a[i]; j++) { xa *= x; while (xa > m) { xa -= m; } } sum += xa; } System.out.println(sum % m); } }