#define _GLIBCXX_DEBUG #define ll long long #include using namespace std; using Graph = vector>; int main(){ int X, N; cin >> X >> N; ll ans = 0; for(int i = 0; i < N; i++){ ll A; cin >> A; int j = 0; ll sum = 1; while(j < A){ sum *= X; sum %= 1000003; j++; } ans += sum; ans %= 1000003; } cout << ans << endl; }