import java.util.*; import java.io.*; public class Main { static final int MOD = 1000003; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 2); long x = Integer.parseInt(first[0]); int n = Integer.parseInt(first[1]); long[] arr = new long[22]; long[] base = new long[22]; arr[0] = 1; arr[1] = x; base[0] = 1; base[1] = 2; for (int i = 2; i <= 21; i++) { arr[i] = (arr[i - 1] * arr[i - 1]) % MOD; base[i] = base[i - 1] * 2; } String[] line = br.readLine().split(" ", n); long ans = 0; for (int i = 0; i < n; i++) { long a = Integer.parseInt(line[i]); long cur = x; long y = 1; for (int j = 20; j >= 0; j--) { if (a / base[j] == 1) { y *= arr[j + 1]; } a %= base[j]; y %= MOD; } ans += y; ans %= MOD; } System.out.println(ans); } }