{"raw_statement":[{"iden":"statement","content":"Polycarp has $n$ coins, the value of the $i$\\-th coin is $a_i$. It is guaranteed that all the values are integer powers of $2$ (i.e. $a_i = 2^d$ for some **non-negative** integer number $d$).\n\nPolycarp wants to know answers on $q$ queries. The $j$\\-th query is described as integer number $b_j$. The answer to the query is the minimum number of coins that is necessary to obtain the value $b_j$ using some subset of coins (Polycarp can use only coins he has). If Polycarp can't obtain the value $b_j$, the answer to the $j$\\-th query is _\\-1_.\n\nThe queries are independent (the answer on the query doesn't affect Polycarp's coins)."},{"iden":"input","content":"The first line of the input contains two integers $n$ and $q$ ($1 \\le n, q \\le 2 \\cdot 10^5$) — the number of coins and the number of queries.\n\nThe second line of the input contains $n$ integers $a_1, a_2, \\dots, a_n$ — values of coins ($1 \\le a_i \\le 2 \\cdot 10^9$). It is guaranteed that all $a_i$ are integer powers of $2$ (i.e. $a_i = 2^d$ for some **non-negative** integer number $d$).\n\nThe next $q$ lines contain one integer each. The $j$\\-th line contains one integer $b_j$ — the value of the $j$\\-th query ($1 \\le b_j \\le 10^9$)."},{"iden":"output","content":"Print $q$ integers $ans_j$. The $j$\\-th integer must be equal to the answer on the $j$\\-th query. If Polycarp can't obtain the value $b_j$ the answer to the $j$\\-th query is _\\-1_."},{"iden":"example","content":"Input\n\n5 4\n2 4 8 2 4\n8\n5\n14\n10\n\nOutput\n\n1\n-1\n3\n2"}],"translated_statement":[{"iden":"statement","content":"Polycarp 有 $n$ 枚硬币，第 $i$ 枚硬币的面值为 $a_i$。保证所有面值均为 $2$ 的整数次幂（即 $a_i = 2^d$，其中 $d$ 为某个非负整数）。\n\nPolycarp 需要回答 $q$ 个查询。第 $j$ 个查询由一个整数 $b_j$ 描述。该查询的答案是：使用他拥有的某些硬币子集来凑出面值 $b_j$ 所需的最少硬币数量。如果 Polycarp 无法凑出面值 $b_j$，则第 $j$ 个查询的答案为 _-1_。\n\n各个查询相互独立（一个查询的答案不会影响 Polycarp 的硬币）。\n\n输入的第一行包含两个整数 $n$ 和 $q$（$1 lt.eq n, q lt.eq 2 dot.op 10^5$），分别表示硬币数量和查询数量。\n\n第二行包含 $n$ 个整数 $a_1, a_2, dots.h, a_n$，表示硬币的面值（$1 lt.eq a_i lt.eq 2 dot.op 10^9$）。保证所有 $a_i$ 均为 $2$ 的整数次幂（即 $a_i = 2^d$，其中 $d$ 为某个非负整数）。\n\n接下来的 $q$ 行，每行包含一个整数。第 $j$ 行包含一个整数 $b_j$，表示第 $j$ 个查询的面值（$1 lt.eq b_j lt.eq 10^9$）。\n\n请输出 $q$ 个整数 $a n s_j$。第 $j$ 个整数必须等于第 $j$ 个查询的答案。如果 Polycarp 无法凑出面值 $b_j$，则该查询的答案为 _-1_。"},{"iden":"input","content":"输入的第一行包含两个整数 $n$ 和 $q$（$1 lt.eq n, q lt.eq 2 dot.op 10^5$），分别表示硬币数量和查询数量。第二行包含 $n$ 个整数 $a_1, a_2, dots.h, a_n$，表示硬币的面值（$1 lt.eq a_i lt.eq 2 dot.op 10^9$）。保证所有 $a_i$ 均为 $2$ 的整数次幂（即 $a_i = 2^d$，其中 $d$ 为某个非负整数）。接下来的 $q$ 行，每行包含一个整数。第 $j$ 行包含一个整数 $b_j$，表示第 $j$ 个查询的面值（$1 lt.eq b_j lt.eq 10^9$）。"},{"iden":"output","content":"请输出 $q$ 个整数 $a n s_j$。第 $j$ 个整数必须等于第 $j$ 个查询的答案。如果 Polycarp 无法凑出面值 $b_j$，则该查询的答案为 _-1_。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n, q \\in \\mathbb{Z}^+ $ denote the number of coins and queries, respectively.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of coin values, where each $ a_i = 2^{d_i} $ for some $ d_i \\in \\mathbb{Z}_{\\ge 0} $.  \nLet $ B = (b_1, b_2, \\dots, b_q) $ be a sequence of query values, where each $ b_j \\in \\mathbb{Z}^+ $.\n\n**Constraints**  \n1. $ 1 \\le n, q \\le 2 \\cdot 10^5 $  \n2. $ 1 \\le a_i \\le 2 \\cdot 10^9 $ and $ a_i = 2^{d_i} $ for some $ d_i \\in \\mathbb{Z}_{\\ge 0} $  \n3. $ 1 \\le b_j \\le 10^9 $\n\n**Objective**  \nFor each query $ b_j $, find the minimum number of coins from $ A $ whose sum equals $ b_j $, i.e., find the smallest $ k \\in \\mathbb{Z}_{\\ge 0} $ such that there exists a multiset $ S \\subseteq A $ with $ |S| = k $ and $ \\sum_{x \\in S} x = b_j $.  \nIf no such subset exists, output $ -1 $.","simple_statement":null,"has_page_source":false}