#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
long long n, x;
int q;
int main() {
  cin >> n;
  scanf("%d", &q);
  while (q--) {
    scanf("%lld", &x);
    long long now = n, st = 0;
    while (x % 2 == 0) {
      long long rk = x / 2 + (now & 1);
      x = rk;
      st = st + now / 2;
      now = (now + 1) / 2;
    }
    printf("%lld\n", (st * 2 + x + 1) / 2);
  }
}
