#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long power(long long first, long long n) {
  long long result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = result * first;
    first = first * first;
    n = n / 2;
  }
  return result;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, q;
  cin >> n >> q;
  while (q--) {
    long long pos;
    cin >> pos;
    long long r = 0;
    for (long long i = 0; i <= 63; i++) {
      long long nr = (2 * n - pos - power(2, i));
      long long dr = power(2, i + 1);
      if (gcd(nr, dr) == dr) {
        r = n - (nr / dr);
        break;
      }
    }
    cout << r << '\n';
  }
}
