// Arup Guha
// 6/5/2026
// Solution to Kattis Problem: Abby's Absolutes
// https://open.kattis.com/problems/abbysabsolutes

using namespace std;
#include <bits/stdc++.h>

int main() {

    // Get max and # of values.
    int k, n;
    cin >> k >> n;

    // Read each number.
    for (int i=0; i<n; i++) {
        int x;
        cin >> x;

        // Closer (or equal) to 1.
        if (x-1 <= k-x)
            cout << "1 ";

        // n is strictly closer.
        else
            cout << k << " ";
    }
    cout << endl;

}
