#include using namespace std; #define X 100 #define MOD 1000003 int n, x; int m[X+1] = { 1, }; long long calc(int a) { if ( m[a] == 0 ) { m[a] = (calc(a-1) * x) % MOD; } return m[a]; } int main() { cin >> x >> n; int r = 0; for ( int i = 0; i < n; i++ ) { int a; cin >> a; r = (r + calc(a)) % MOD; } cout << r << endl; return 0; }