#include #include #include #include #define N_MAX 100 #define MOD 1000003 using namespace std; int power(int x, int a) { int ans = 1; for (int i = 0; i < a; ++i) ans = (ans * x) % MOD; return ans; } int main() { int x, N, a[N_MAX]; cin >> x >> N; for (int i = 0; i < N; ++i) { cin >> a[i]; a[i] %= MOD - 1; } sort(a, a + N); int ans = power(x, a[0]); for (int i = 1; i < N; ++i) { ans += power(x, a[i]); ans %= MOD; } cout << ans; return 0; }