func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:1024000000,1024000000 )   using namespace std;   int ans, a[5010], K, n;   map<int, int> g;   int main() {     int i, j, k, ca = 0, m;     scanf( %d%d , &n, &K);     for (i = 0; i < n; i++) scanf( %d , &a[i]);     for (i = 0; i < n; i++)       for (j = 1; j <= K; j++) {         int first = a[i] * j;         if (!g.count(first))           g[first] = j;         else           g[first] = min(g[first], j);       }     scanf( %d , &m);     while (m--) {       int first;       scanf( %d , &first);       if (first < a[0]) {         puts( -1 );         continue;       } else {         int ans = K + 1;         if (g.count(first)) ans = min(ans, g[first]);         for (i = 0; i < n; i++) {           if (a[i] > first) break;           int second = min(K, first / a[i]);           for (j = 1; j < second; j++) {             int rem = first - j * a[i];             if (g.count(rem)) ans = min(ans, j + g[rem]);           }         }         if (ans >= K + 1) ans = -1;         printf( %d n , ans);       }     }   }   