func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   int a[5005];   int q, x;   bool bfind(int p) {     int lf = 0;     int rt = n - 1;     int mid;     while (lf <= rt) {       mid = (lf + rt) / 2;       if (a[mid] < p) {         lf = mid + 1;       } else if (a[mid] > p) {         rt = mid - 1;       } else         return true;     }     return false;   }   int main() {     while (scanf( %d %d , &n, &k) != EOF) {       for (int i = 0; i < n; i++) {         scanf( %d , &a[i]);       }       scanf( %d , &q);       while (q--) {         int mn = k + 1;         scanf( %d , &x);         for (int i = n - 1; i >= 0; i--) {           for (int j = 0; j <= k; j++) {             if (a[i] * j == x) {               mn = min(mn, j);               break;             }             if (a[i] * j > x) break;             for (int m = 1; m <= k - j; m++) {               if ((x - a[i] * j) % m != 0) continue;               int tmp = (x - a[i] * j) / m;               if (bfind(tmp)) mn = min(mn, j + m);             }           }         }         if (mn > k)           printf( -1 n );         else           printf( %d n , mn);       }     }     return 0;   }   