func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m;   int dp[3333];   bool d[3333];   int a[3333];   bool f[3333];   int qu[3333];   int main() {     ios::sync_with_stdio(false);     cin >> n >> m;     for (int i = 1; i <= m; i++) {       int x;       cin >> x;       d[x] = true;     }     m = 0;     for (int i = 0; i <= 1000; i++)       if (d[i]) {         a[++m] = i - n;       }     qu[1] = 0;     f[1000] = true;     int l = 1;     int r = 1;     while (l <= r) {       int u = qu[l];       l++;       for (int i = 1; i <= m; i++) {         int v = u + a[i];         if (v >= -1000 && v <= 1000) {           if (f[v + 1000] == false) {             f[v + 1000] = true;             qu[++r] = v;             dp[v + 1000] = dp[u + 1000] + 1;           }         }       }     }     int ret = 1000000001;     for (int i = -1000; i <= 1000; i++)       if (f[i + 1000]) {         bool ok = false;         for (int j = 1; j <= m; j++)           if (i + a[j] == 0) {             ok = true;             break;           }         if (ok) ret = min(ret, dp[i + 1000] + 1);       }     if (ret == 1000000001)       cout << -1;     else       cout << ret;     return 0;   }   