#include <bits/stdc++.h>
using namespace std;
long long N;
int M;
long long K;
int main() {
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    scanf("%I64d", &K);
    if (K % 2 == 1) {
      printf("%I64d\n", (K + 1) / 2);
      continue;
    }
    long long kk = N - K / 2;
    K += kk;
    while (kk % 2 == 0) {
      kk /= 2;
      K += kk;
    }
    printf("%I64d\n", (K + 1) / 2);
  }
  return 0;
}
