#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define MOD 1000003 // x^n ll mod_pow(ll x, ll n) { if (n == 0) return 1; ll res = mod_pow(x * x % MOD, n / 2); if (n & 1) res = res * x % MOD; return res; } // x^{-1} ll mod_inv(ll x) { return mod_pow(x, MOD - 2); } int main() { ll x, n; cin >> x >> n; vector a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } ll ans = 0; for (int i = 0; i < n; ++i) { ll res = mod_pow(x, a[i]); ans = (ans + res) % MOD; } cout << ans << endl; return 0; }