#include "bits/stdc++.h" using namespace std; typedef long long Int; #define REP(i,n) for(int (i)=0;(i)<(int)(n);++(i)) const Int MOD = 1000003; long pow_mod(Int a, Int n, Int MOD) { Int res = 1; while (n > 0) { if (n & 1) { res *= a; res %= MOD; } a = a * a % MOD; n >>= 1; } return res; } int a[100]; int main() { Int x; int N; cin >> x >> N; REP(i, N) cin >> a[i]; Int ans = 0; REP(i, N) { ans += pow_mod(x, a[i], MOD); ans %= MOD; } cout << ans << endl; }