using System; using System.Linq; namespace _16 { class Program { static void Main(string[] args) { int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray(); long[] l = new long[100000000]; l[0] = 1; long ret = 0; for (int j = 1; j < 100000000; j++) { l[j] = l[j - 1] * x[0] % 1000003; } for (int i = 0; i < x[1]; i++) { ret += l[a[i]]; } Console.WriteLine(ret); } } }