import java.util.*; public class Main { private static Scanner sc = new Scanner(System.in); private static long[] ary; public static void main(String[] args) throws Exception { long x = nextLong(); int n = nextInt(); ary = nextLong(n); long ans = 0; for (int i = 0;i < n;i++) { ans += pow(x, ary[i])%1000003; } System.out.println(ans); } private static long pow(long n, long p) { long ans; if (p==0) return 1; if (p==1) return n; if (p==2) return n*n; if (p%2==0) { ans = pow(n,p/2)*pow(n,p/2); } else { ans = pow(n,p/2)*pow(n,p/2)*n; } System.out.println(n+" "+p+" "+ans); return ans%1000003; } private static int nextInt() { return sc.nextInt(); } private static long nextLong() { return sc.nextLong(); } private static float nextFloat() { return sc.nextFloat(); } private static int[] nextInt(int n) { int[] ret = new int[n]; for (int i = 0;i < n;i++) { ret[i] = nextInt(); } return ret; } private static long[] nextLong(int n) { long[] ret = new long[n]; for (int i = 0;i < n;i++) { ret[i] = nextLong(); } return ret; } private static float[] nextFloat(int n) { float[] ret = new float[n]; for (int i = 0;i < n;i++) { ret[i] = nextFloat(); } return ret; } }