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