import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string; import std.bigint; auto rdsp(){return readln.splitter;} void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;} void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);} void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);} const mod1 = 168647939L, mod2 = 592951213L, mod = mod1*mod2; void main() { int n, m; readV(n, m); int[] x; readA(m, x); auto n2 = (n+1)/2, c = new uint[](n2); auto calc(int mod) { c[] = 0; c[0] = 1; foreach (i; 1..n2) foreach (j; 0..m) if (i >= x[j]) (c[i] += c[i-x[j]]) %= mod; auto r = 0uL; foreach (j; 0..m) foreach (i; max(0, n2-x[j])..min(n-x[j], n2)) (r += c[i].to!ulong*c[n-1-(i+x[j])].to!ulong) %= mod; return r.to!long; } auto r1 = BigInt(calc(mod1)), r2 = BigInt(calc(mod2)); long a, b; exEuclid(mod1, mod2, a, b); writeln(((r1*b*mod2+r2*a*mod1)%mod+mod)%mod); } pure T exEuclid(T)(T a, T b, ref T x, ref T y) { auto g = a; x = 1; y = 0; if (b) { g = exEuclid(b, a%b, y, x); y -= a/b*x; } return g; }