Under construction

Still being built. Things may change

Natatorium

Interview

Time limit2sMemory limit1024 MB

Summary
Given an area C that is the product of two distinct primes, find the two listed primes whose product is C and print them in increasing order.
Level

Easy3 of 10

Topics
Hash map, Number theory
Solved
No attempts yet

Problem

The Arithmetics Department of Tomorrow Programming School plans to build a new pool in the basement of its building. The pool will mainly test innovative floating point arithmetic algorithms, especially how their floating properties behave in different liquids. Occasionally, staff members will also be allowed into the pool. To make the pool fit human needs, the department must choose its dimensions. The pool will be rectangular and must not be a square. Its exact surface area CC is fixed by the algorithms to be tested there. The company that builds the pool has offered a list of possible side lengths and guarantees that a pool with the given area can be built from lengths in the list. The department chooses which pair to use.

The list is fairly long, so the department has hired a junior programmer to find which lengths can be chosen. Before starting, the programmer made two observations. First, every available side length is a prime. Second, the surface area CC is a product of two distinct primes. He thinks this information may help him find suitable side lengths quickly. Solve the problem before he does.

Input

The first line contains an integer CC (1≤C≤10181 \le C \le 10^{18}), the area of the pool surface. The second line contains an integer MM (1≤M≤2⋅1051 \le M \le 2 \cdot 10^5), the number of side lengths offered by the company. The third line contains MM distinct primes P1,…,PMP_1, \ldots, P_M (1<Pi<1091 < P_i < 10^9), separated by spaces. All measurements use the same unit.

Output

Print one line with two side lengths from the offered list that can be used to build the pool, separated by a space. The first length must be smaller than the second.

Examples1

  1. Example 1

    Input
    15
    5
    7 2 5 11 3
    
    Expected output
    3 5