#include using namespace std; const int MOD = 1000003; typedef long long LL; LL pow(LL x, int a){ if(a == 0) return 1; if(a % 2) return (x * pow(x, a-1)) % MOD; LL ret = pow(x, a/2) % MOD; return (ret * ret) % MOD; } int main(){ LL x, r; int n, a; scanf("%lld %d", &x, &n); r = 0; for(int i = 0; i < n; i++){ scanf("%d", &a); r += pow(x, a); r %= MOD; } printf("%lld\n", r); return 0; }