#define REP(i,n) for(int i=0; i<(int)(n); i++) #include inline int getInt(){ int s; scanf("%d", &s); return s; } typedef long long ll; #include using namespace std; const ll mod = 1000003; ll mpow(ll base, ll e){ ll ret = 1; while(e){ if(e & 1) ret = (ret * base) % mod; base = (base * base) % mod; e >>= 1; } return ret; } int main(){ const ll x = getInt(); const int n = getInt(); ll ans = 0; REP(i,n) ans = (ans + mpow(x, getInt())) % mod; printf("%lld\n", ans); return 0; }