#include using ll = long long; constexpr int MOD1 = 168647939; constexpr int MOD2 = 592951213; template constexpr std::pair extgcd(const T a, const T b) { if (b == 0) { return std::pair{1, 0}; } const auto p = extgcd(b, a % b); return {p.second, p.first - p.second * (a / b)}; } template std::pair ChineseRemainderTheorem(const std::pair& a1, const std::pair& a2) // (mod, value) { const T p1 = a1.first, m1 = a1.second, p2 = a2.first, m2 = a2.second, m = p1 * p2; if (m1 == m2) { return {p1 * p2, m1}; } auto p = extgcd(p1, p2); return {m, (((p1 * p.first * (m2 - m1) + m1) % m) + m) % m}; } int main() { int N, M; std::cin >> N >> M; std::vector x(M); for (int i = 0; i < M; i++) { std::cin >> x[i]; } const int H = (N + 1) / 2; std::vector dp1(H, 0), dp2(H, 0); dp1[0] = dp2[0] = 1; for (int i = 1; i < H; i++) { for (int j = 0; j < M; j++) { if (i >= x[j]) { (dp1[i] += dp1[i - x[j]]) %= MOD1; (dp2[i] += dp2[i - x[j]]) %= MOD2; } } } ll ans1 = 0, ans2 = 0; for (int j = 0; j < M; j++) { for (int i = std::max(0, x[j] - H); i < std::min(N - H, x[j]); i++) { (ans1 += (ll)dp1[H - x[j] + i] * dp1[N - H - i - 1] % MOD1) %= MOD1; (ans2 += (ll)dp2[H - x[j] + i] * dp2[N - H - i - 1] % MOD2) %= MOD2; } } const auto ans = ChineseRemainderTheorem<__int128_t>({MOD1, ans1}, {MOD2, ans2}); std::cout << (ll)ans.second << std::endl; return 0; }