#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   const int N = 2e5 + 10;   const long long inf = 1e18;   const int maxm = 1005;   vector<vector<char>> matrix(maxm, vector<char>(maxm));   struct event {     int x, y, size;   };   int dx[] = {0, 0, 1, -1};   int dy[] = {-1, 1, 0, 0};   class even {    public:     int a, b, c;   };   class evenl {    public:     int a, b, c, ind;   };   struct myComp {     constexpr bool operator()(evenl f, evenl s) const noexcept {       int z = f.b - f.a;       int z2 = s.b - s.a;       z -= f.c;       z2 -= s.c;       return z < z2;     }   };   long long poww(long long a, long long b, long long m) {     if (b == 0) return 1ll;     if (b % 2 == 1) return a * poww(a, b - 1, m) % m;     long long rs = poww(a, b / 2, m);     rs = rs * rs % m;     return rs;   }   long long fact[N];   long long ncr(long long n, long long r) {     long long num = fact[n];     long long deno = fact[n - r] * fact[r] % mod;     deno = poww(deno, mod - 2, mod);     num = num * deno;     num = num % mod;     return num;   }   long long convert(long long a, long long b) {     string s;     while (a > 0) {       long long p = a % b;       s += p +  0 ;       a = a / b;     }     reverse(s.begin(), s.end());     long long res = stoi(s);     return res;   }   long long make(long long a, long long b, long long c) {     while (a < b) a *= c;     return a % b;   }   long long frog_jump(long long pos, long long n) {     while (pos % 2 == 0) {       pos = pos + (n - pos / 2);     }     return (pos + 1) / 2;   }   void solve() {     long long n, q;     cin >> n >> q;     for (int i = 0; i < q; i++) {       long long x;       cin >> x;       if (x % 2 != 0) {         cout << (x + 1) / 2 <<   n ;         continue;       }       long long z = frog_jump(x, n);       cout << z <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     solve();   }   