#include <bits/stdc++.h>
using namespace std;
long long ansp = 0;
long long n1, q;
void Do(long long tempn, long long pos) {
  if (pos % 2 != 0) {
    ansp += pos;
    return;
  } else {
    long long ans = tempn + pos / 2;
    if (tempn % 2 == 0) {
      ansp += tempn;
      pos = ans - tempn;
      tempn /= 2;
      Do(tempn, pos);
    } else {
      ansp += tempn - 1;
      pos = ans - tempn + 1;
      tempn /= 2;
      tempn++;
      Do(tempn, pos);
    }
  }
}
int main() {
  cin >> n1 >> q;
  long long p;
  for (long long i = 0; i < q; i++) {
    ansp = 0;
    cin >> p;
    Do(n1, p);
    cout << (ansp + 1) / 2 << endl;
  }
  return 0;
}
