#include<bits/stdc++.h> #define int long long #define fi first #define se second #define PII pair<int, int> usingnamespace std; constint N = 1e6 + 5; voidsolve() { int n, k; cin >> n >> k; string ans = "9999999999999"; string s; cin >> s; int pos = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == '1') pos++; } for (int i = 0; i <= k; i++) { string t; int now = i + pos; while (now && t.size() < k) { // 保留k位数 t += (now % 2 + '0'); now >>= 1; } for (int j = t.size(); j < k; ++j) t += '0'; reverse(t.begin(), t.end()); int cnt = count(t.begin(), t.end(), '1'); if (cnt == i) { ans = min(ans, t); } } if (ans == "9999999999999") cout << "None" << '\n'; else cout << ans << '\n'; return; } signedmain() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t = 1; cin >> t; while (t--) solve(); return0; }