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