import std.algorithm, std.conv, std.range, std.stdio, std.string; const md = 1_000_003L; void main() { auto rd = readln.split, x = rd[0].to!long, n = rd[1].to!size_t; auto ai = readln.split.to!(long[]); auto maxA = ai.reduce!max; auto xi = new long[](maxA + 1); xi[0] = 1; foreach (i; maxA.iota) xi[i + 1] = (xi[i] * x) % md; auto r = ai.map!(a => xi[a]).sum % md; writeln(r); }