#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000003; long long M[1000003]; int main() { int x,N; cin >> x >> N; vector A(N); for ( int i = 0; i < N; i++ ) { cin >> A[i]; } M[0] = 1; long long a = 1; for ( int i = 1; i < 1000003; i++ ) { a *= x; a %= MOD; M[i] = a; } long long ans = 0; for ( int i = 0; i < N; i++ ) { ans += ( A[i] >= MOD ) ? M[ 1 + (A[i]%MOD) ] : M[A[i]]; ans %= MOD; } cout << ans << endl; return 0; }