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