#include using namespace std; #define rep(i,n) for (int i=0;i<(n);i++) #define rep2(i,a,b) for (int i=(a);i<(b);i++) #define rrep(i,n) for (int i=(n)-1;i>=0;i--) #define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--) #define all(a) (a).begin(),(a).end() typedef long long ll; typedef pair P; typedef vector vi; typedef vector

vp; typedef vector vll; const ll mod = 1000003; ll powmod (ll a, ll p) { ll ret = 1; ll mul = a; for (; p > 0; p >>= 1, mul = (mul * mul) % mod) { if ((p & 1) == 1) ret = (ret * mul) % mod; } return ret; } signed main() { std::ios::sync_with_stdio(false); std::cin.tie(0); ll x, N; cin >> x >> N; vll a(N); rep(i, N) cin >> a[i]; ll ans = 0; rep(i, N) { ans += powmod(x, a[i]); ans %= mod; } cout << ans << endl; }