void main(){ import std.stdio, std.string, std.conv, std.algorithm; int m; rd(m); int n; rd(n); auto a=readln.split.to!(int[]); auto rec=new long[](m+1); fill(rec, -1); rec[0]=0; foreach(e; a)for(int i=0; i+e<=m ;i++){ if(rec[i]>=0) chmax(rec[i+e], rec[i]+1); } long sum=0; foreach(long i, e; rec)if(e>0){ if(isPrime(m-i)) sum+=e; } writeln(sum+(m/reduce!(min)(a))); } bool isPrime(long x){ if(x<=1) return false; bool ok=true; for(long i=2; i*i<=x; i++){ ok&=(x%i>0); } return ok; } void chmax(T)(ref T x, T y){ if(x