#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, d, e, i, j, k;
  scanf("%lld %lld", &a, &b);
  while (b--) {
    scanf("%lld", &c);
    while (c % 2 == 0) {
      c = (c / 2) + a;
    }
    printf("%lld\n", (c / 2) + 1);
  }
}
