import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x = scan.nextInt(); int N = scan.nextInt(); long []a = new long[N]; for(int i = 0; i < N; i++) { a[i] = scan.nextInt(); } scan.close(); int k = 1000003; long ans = 0; for(int i = 0; i < N; i++) { ans += pow(x, a[i], k); ans = ans % k; } System.out.println(ans % k); } public static long pow(long x, long n, int k) { if(n == 0) { return 1; } if(n % 2 == 0) { return pow(x * x % k, n / 2, k); }else { return x * pow(x, n - 1, k) % k; } } }