#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
constexpr auto MOD = 1000000007LL;
constexpr auto LINF = (1LL << 60);
constexpr auto INF = 2147483647LL;
constexpr auto PI = 3.1415926535897932384626433;
constexpr auto EPS = 1E-9;
template <typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2> p) {
  out << p.first << ' ' << p.second;
  return out;
}
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& p) {
  in >> p.first >> p.second;
  return in;
}
auto printVector = []<typename T>(ostream& out, vector<T> v) {
  copy(v.begin(), v.end(), ostream_iterator<T>(out, " "));
};
int main() {
  ios_base::sync_with_stdio(false);
  ll n;
  int q;
  cin >> n >> q;
  while (q--) {
    ll pos;
    cin >> pos;
    for (ll have = n - 1, st = 2; pos % 2 == 0;) {
      pos = st + have + (pos - st) / 2;
      ll prv = st;
      st = st + have;
      if (prv % 2 == 0)
        have = (have + 1) / 2;
      else
        have /= 2;
    }
    cout << (pos + 1) / 2 << endl;
  }
  return 0;
}
