#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000003; int M[1000003]; int main() { long long 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[ (A[i]/MOD) + (A[i]%MOD) ] : M[A[i]] ); ans %= MOD; } cout << ans << endl; return 0; }