#include using namespace std; const long long mod = 1000003; long long pow(long long a, long long x){ long long ans = 1; while (x > 0){ if (x&1) ans = (ans*a)%mod; x >>= 1; a = (a*a)%mod; } return ans; } int main(){ long long n, a; cin >> a >> n; long long x[n + 1] = {0}; x[0] = 1; long long res = 0; for (int i = 1;i <= n; ++i){ cin >> x[i]; res = (res + pow(a, x[i]))%mod; } cout << res << endl; }