#include using namespace std; #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--) #define SZ(a) int(a.size()) #define ALL(a) a.begin(), a.end() #define PB push_back #define MP make_pair #define F first #define S second typedef long long LL; typedef vector VI; typedef pair PII; typedef long double db; const int MAGIC = 1'047; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; vector h(n); FOR(i, 0, n) cin >> h[i]; VI as; FOR(it, 0, 3) FOR(i, max(1, (it * k) / 2 - MAGIC), min((it * k) / 2 + MAGIC, k)) as.PB(i); sort(ALL(as)); as.resize(unique(ALL(as)) - as.begin()); LL ansU = -1; LL ansD = -1; PII res; for(int a : as) { assert(0 < a && a < k); LL curU = 0; FOR(i, 0, n) curU += (h[i] + a - 1) / a; LL curD = (k - a); if(ansU == -1 || ansU * (__int128)curD > curU * (__int128) ansD) { ansU = curU; ansD = curD; res = {a, k - a}; } } cout << res.F << " " << res.S << "\n"; return 0; }