#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector a(n), ans; for(auto &&v : a) cin >> v; sort(a.begin(), a.end()); priority_queue, vector>, greater>> pq; ans.emplace_back(a[1]); pq.emplace(2 * a[1], a[1]); for(int i = 2; i < n; i++){ if(pq.top().first < a[i]){ cout << -1 << '\n'; return 0; } bool flg = true; while(a[i] == pq.top().first){ auto [v, d] = pq.top(); pq.emplace(v + d, d); pq.pop(); flg = false; } if(flg){ ans.emplace_back(a[i]); pq.emplace(2 * a[i], a[i]); } } if(pq.top().first <= m){ cout << -1 << '\n'; return 0; } cout << ans.size() << '\n'; for(int i = 0; i < ans.size(); i++){ cout << ans[i] << (i + 1 == ans.size() ? '\n' : ' '); } }