#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n = 0, q = 0;
  cin >> n >> q;
  long long mn = (n + 1) / 2 + 1;
  while (q--) {
    long long x = 0;
    cin >> x;
    x--;
    if (x % 2 == 0)
      cout << x / 2 + 1 << endl;
    else {
      while (x % 2 != 0) x = (n + x / 2);
      cout << x / 2 + 1 << endl;
    }
  }
  return 0;
}
