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