import java.io.*; import java.util.*; import java.math.*; class Main { public static void out (Object o) { System.out.println(o); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line1 = br.readLine().split(" "); String[] line2 = br.readLine().split(" "); int x = Integer.parseInt(line1[0]); int n = Integer.parseInt(line1[1]); int ans = 0, m = 1000003; long[] mm = new long[m]; mm[0] = 1; for (int i = 1; i < m; i++) { mm[i] = mm[i - 1] * x % m; } for (int i = 0; i < n; i++) { int a = Integer.parseInt(line2[i]); ans += mm[a % m]; ans %= m; } out(ans); } }