#include <bits/stdc++.h>
using namespace std;
const long long MODL = (long long)1e18 + 3;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
const int N = 1e6 + 9;
long long n;
long long compute(long long x) {
  if (x & 1)
    return (x + 1) / 2;
  else
    return compute(x + n - x / 2);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int q;
  cin >> q;
  while (q--) {
    long long x;
    cin >> x;
    cout << compute(x) << endl;
  }
  return 0;
}
