#include #define rep(i, a, n) for(int i = a; i < n; i++) #define repp(i, n) rep(i, 0, n) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define int long long using namespace std; int x, n; const int mod = 1000003; int mod_pow(int x, int a){ if(a == 0) return 1; if(a % 2) return x * mod_pow(x, a - 1) % mod; int res = mod_pow(x, a / 2); return res * res % mod; } signed main(){ cin >> x >> n; vector a(n); rep(i, 0, n) cin >> a[i]; int ans = 0; rep(i, 0, n){ ans += mod_pow(x, a[i]); ans %= mod; } cout << ans << endl; }