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