#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 200001;
const int M = 20;
const int MOD = 1000000007;
const int inf = 1234567890;
const long long INF = 1122334455667788990;
long long n;
long long f(long long p) {
  if (p & 1LL) return (p + 1) / 2;
  return f(p + (n - p / 2));
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int tc = 1, cs = 0;
  while (tc--) {
    long long q, a;
    cin >> n >> q;
    while (q--) {
      cin >> a;
      cout << f(a) << '\n';
    }
  }
}
