#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5;
long long n, q;
long long a[N], now;
long long solve(long long x) {
  if (x & 1) return x + 1 >> 1;
  return solve(x + (n - (x >> 1)));
}
void work1() {
  scanf("%lld", &q);
  long long x;
  while (q--) {
    scanf("%lld", &x);
    printf("%lld\n", solve(x));
  }
}
int main() {
  scanf("%lld", &n);
  work1();
  return 0;
}
