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