using namespace std; #include int main() { int c, m; cin >> c >> m; int tmp; for (int i = 0; i < m; ++i) { cin >> tmp; if ((tmp < c) && (c % tmp) == 0 ) { if (tmp > c / tmp) { cout << c / tmp << " " << tmp << endl; break; } else { cout << tmp << " " << c / tmp << endl; break; } } } return 0; }