#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long size = 1e6 + 7;
int arr[size];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, q;
  cin >> n >> q;
  while (q--) {
    long long x;
    cin >> x;
    long long ans;
    while (x <= 2 * n) {
      if (x % 2 == 1) {
        ans = (x + 1) / 2;
        break;
      } else {
        x = x + (n - x / (long long)2);
      }
    }
    cout << ans << endl;
  }
}
