#include <bits/stdc++.h>
using namespace std;
template <class T>
long long size(const T &x) {
  return x.size();
}
const long long INF = ~(1 << 31);
const double pi = acos(-1);
const double EPS = 1e-9;
long long rec(long long n, long long x) {
  if (x == 0) x = n;
  if (x % 2 == 1) return (x + 1) / 2;
  long long first = (n + 1) / 2;
  long long second = x / 2 - n % 2;
  return rec(n - first, second) + first;
}
int main() {
  cin.sync_with_stdio(false);
  long long n, q;
  cin >> n >> q;
  while (q--) {
    long long x;
    cin >> x;
    cout << rec(n, x) << endl;
  }
  return 0;
}
