#include <bits/stdc++.h>
using namespace std;
long long n, q;
int main() {
  scanf("%lld%lld", &n, &q);
  long long x;
  while (q--) {
    scanf("%lld", &x);
    if (x & 1) {
      printf("%lld\n", (x + 1) / 2);
    } else {
      long long pos = x;
      long long mv = n - x / 2;
      while (pos < 2 * n) {
        pos += mv;
        if (mv % 2 == 1) break;
        mv /= 2;
      }
      printf("%lld\n", (pos + 1) / 2);
    }
  }
  return 0;
}
