#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ff first
#define ss second
#define ll long long
using namespace std;

const int N = 31700;
bool cpl[N];
vector < int > pp;

int main()
{
    FAST;

    for(int i = 2; i < N; i++)
    {
        if(cpl[i] || (long long)i * i > N) continue;
        for(int j = i * i; j < N; j += i) cpl[j] = true;
    }
    for(int i = 2; i < N; i++) if(!cpl[i]) pp.push_back(i);

//    for(auto it : pp) cout << it << " ";
//    cout << "\n";
//    cout << pp.size() << "\n";






    long long n; cin >> n;
    int k; cin >> k;
    vector < int > v(k);
    for(int i = 0; i < k; i++) cin >> v[i];
    sort(begin(v), end(v));

    vector < vector < int > > del(k + 10);

    for(int i = 0; i < k; i++)
    {
        int t = v[i];
        for(auto it : pp)
        {
            while(t % it == 0)
            {
                t /= it;
                del[i].push_back(it);
            }
        }
    }
    for(int i = 0; i < k; i++) cout << "1 ";

    return 0;
}