func_code_string: #include <bits/stdc++.h>   using namespace std;   ifstream in( test.in );   ofstream out( test.out );   const int DIM = 2e3 + 1;   const int INF = 1e9 + 7;   int dp[DIM];   set<int> mst;   deque<int> que;   vector<int> edg[DIM];   int main() {     ios::sync_with_stdio(false);     cin.tie();     cout.tie();     int k, n;     cin >> k >> n;     for (int i = 1; i <= n; i++) {       int x;       cin >> x;       mst.insert(x - k);     }     for (int x : mst) {       for (int i = 0; i < DIM; i++) {         if (i + x > -1 && i + x < DIM) edg[i].push_back(i + x);       }     }     fill(dp, dp + DIM, INF);     dp[DIM / 2] = 0;     que.push_back(DIM / 2);     int ans = INF;     for (; que.empty() == false; que.pop_front()) {       int x = que.front();       for (int y : edg[x]) {         if (dp[y] == INF)           dp[y] = dp[x] + 1, que.push_back(y);         else if (y == DIM / 2)           ans = min(ans, dp[x] + 1);       }     }     cout << (ans == INF ? -1 : ans) << endl;     return 0;   }   