#include using namespace std; using ull = unsigned long long; void solve() { ull area, n; cin >> area >> n; ull f = 0, s = 0; ull current; for (ull i = 0; i < n; i++){ cin >> current; if (area % current) { continue; } if (f){ if (f * current == area){ s = current; break; } } else { f = current; } } if (f > s) { std::swap(f, s); } cout << f << " " << s << endl; } signed main() { cin.sync_with_stdio(false); cin.tie(0); solve(); return 0; }