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