#include #include #define Z 1000003 int x, N; long long int a; int compare_int(const void *a, const void *b); int main() { int xn[100]; long long int an[100]; long long int sum = 0; long long int tmp; long long int ani; scanf("%d %d\n", &x, &N ); for( int i = 0; i < N - 1 ; i++ ) { scanf("%lld ", an+i ); } scanf("%lld\n", an+N-1 ); qsort( an, N, sizeof( long long int) , compare_int ); tmp = 1; ani = 0; for( int i = 0; i <= an[N-1]; i++ ) { while( i == an[ani] ) { sum += tmp; sum = sum %Z; ani++; } tmp = tmp * x; tmp = tmp % Z; } printf("%d\n", sum ); return 0; } int compare_int(const void *a, const void *b) { return *(long long int*)a - *(long long int*)b; }