#include <bits/stdc++.h>
using namespace std;
void qmax(long long &x, long long y) {
  if (x < y) x = y;
}
void qmin(long long &x, long long y) {
  if (x > y) x = y;
}
inline long long read() {
  char s;
  long long k = 0, base = 1;
  while ((s = getchar()) != '-' && s != EOF && !(isdigit(s)))
    ;
  if (s == EOF) exit(0);
  if (s == '-') base = -1, s = getchar();
  while (isdigit(s)) {
    k = k * 10 + (s ^ '0');
    s = getchar();
  }
  return k * base;
}
inline void write(long long x) {
  static char cnt, num[15];
  cnt = 0;
  if (!x) {
    putchar('0');
    return;
  }
  for (; x; x /= 10) num[++cnt] = x % 10;
  for (; cnt; putchar(num[cnt--] + 48))
    ;
}
long long n, q, x;
signed main() {
  n = read();
  q = read();
  while (q--) {
    x = read();
    while (!(x & 1)) x += n - x / 2;
    x = (x + 1) / 2;
    printf("%I64d\n", x);
  }
  return 0;
}
