#include <bits/stdc++.h>
using namespace std;
long long n, m;
int main() {
  int i, j;
  scanf("%I64d%I64d", &n, &m);
  while (m--) {
    long long x;
    scanf("%I64d", &x);
    while (x % 2 == 0) x += (n - x / 2);
    cout << x / 2 + 1 << endl;
  }
  return 0;
}
