#include <bits/stdc++.h>
using namespace std;
const long long sz = 2e5 + 5;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
long long fExpo(long long x, long long y) {
  long long res = 1ll;
  x = x % 998244353;
  while (y > 0) {
    if (y & 1) res = (res * x) % 998244353;
    y = y >> 1;
    x = (x * x) % 998244353;
  }
  return res;
}
void solve() {
  long long n, q;
  cin >> n >> q;
  while (q--) {
    long long p;
    cin >> p;
    if (p & 1) {
      cout << (p + 1LL) / 2LL << endl;
      continue;
    } else {
      while (!(p & 1)) {
        p += (n - p / 2LL);
      }
      cout << (p + 1LL) / 2LL << endl;
      continue;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  solve();
  return 0;
}
