import java.util.*; public class Yuki016 { public static void main(String[] args) { Yuki016 p = new Yuki016(); } public Yuki016() { Scanner scanner = new Scanner(System.in); final int x = scanner.nextInt(); final int N = scanner.nextInt(); final int[] a = new int[N]; int zeroCount = 0; final int MOD = 1000003; long tmp = x; long[] muls = new long[N]; Arrays.fill(muls, 1); long ans2=1; for (int i = 0; i < N; i++) { a[i] = scanner.nextInt(); if (a[i] == 0) { zeroCount++; } } while (zeroCount < N) { for (int i = 0; i < N; i++) { if (a[i] > 0) { if (a[i] % 2 == 1) { muls[i] = muls[i] * tmp % MOD; } a[i] >>= 1; if (a[i] == 0) { zeroCount++; } } } tmp = (tmp * tmp) % MOD; } long ans = 0; for (int i = 0; i < N; i++) { ans += muls[i]; } System.out.println(ans % MOD); } }