#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
long long n;
int Q;
void ReadInput() {
  cin >> n >> Q;
  n *= 2LL;
}
long long Get(long long first) {
  if (first % 2 == 1) return (first + 1) / 2;
  return Get(first + (n - first) / 2);
}
void Solve() {
  while (Q-- > 0) {
    long long first;
    cin >> first;
    cout << Get(first) << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ReadInput();
  Solve();
}
