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