#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 1e9 + 7;
const int N = 2e5 + 7;
const int M = 5e6 + 7;
long long lowbit(long long x) { return x & (-x); }
signed main() {
  ios::sync_with_stdio(false);
  long long n, x;
  int q;
  cin >> n >> q;
  while (q--) {
    cin >> x;
    if (x & 1ll)
      cout << (x + 1ll) / 2 << "\n";
    else {
      long long y = 2 * n - x;
      long long q = lowbit(2 * n - x);
      cout << n - (y / q - 1) / 2 << "\n";
    }
  }
  return 0;
}
