#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
using matrix = vector<vector<long long>>;
long long solve(long long n, long long pos) {
  if (n <= 2) {
    return pos;
  }
  if (n == 3) {
    if (pos == 1) {
      return 1;
    }
    if (pos == 2) {
      return 3;
    }
    if (pos == 3) {
      return 2;
    }
  }
  long long L = (n / 2) + (n % 2);
  long long R = n - L;
  if (pos % 2 == 1) {
    return (pos + 1) / 2;
  }
  long long ppos = pos / 2 - (n % 2);
  if (ppos <= 0) {
    ppos += R;
  }
  return solve(R, ppos) + L;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, q;
  cin >> n >> q;
  while (q--) {
    long long pos;
    cin >> pos;
    cout << solve(n, pos) << '\n';
  }
}
