#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n;
int q;
int main() {
  n = read();
  q = read();
  while (q--) {
    long long x = read();
    if (x & 1)
      printf("%I64d\n", (x + 1) >> 1);
    else {
      long long t = x >> 1;
      t = n - t;
      while (!(t & 1)) t >>= 1;
      t = (t + 1) >> 1;
      t = n - t + 1;
      printf("%I64d\n", t);
    }
  }
  return 0;
}
