#include <bits/stdc++.h>
using namespace std;
const long long sz = 1e6 + 7;
const long long sz2 = 1e3 + 7;
const long long inf = 1e14 + 7;
long long l, r, n, m, k, q, x;
long long c;
long long mex[sz];
long long a[sz2][sz2];
long long f(long long in) {
  if (in % 2 == 1)
    return (in + 1) / 2;
  else
    return f(in + (n - in / 2));
}
int main() {
  cin >> n >> q;
  for (int i = 0; i < q; ++i) {
    cin >> x;
    cout << f(x) << "\n";
  }
}
