Dima is a beginner programmer. During his working process, he regularly has to repeat the following operation again and again: to remove every second element from the array. One day he has been bored with easy solutions of this problem, and he has come up with the following extravagant algorithm.

Let's consider that initially array contains n numbers from 1 to n and the number i is located in the cell with the index 2i - 1 (Indices are numbered starting from one) and other cells of the array are empty. Each step Dima selects a non-empty array cell with the maximum index and moves the number written in it to the nearest empty cell to the left of the selected one. The process continues until all n numbers will appear in the first n cells of the array. For example if n = 4, the array is changing as follows: [Image] 

You have to write a program that allows you to determine what number will be in the cell with index x (1 ≤ x ≤ n) after Dima's algorithm finishes.


-----Input-----

The first line contains two integers n and q (1 ≤ n ≤ 10^18, 1 ≤ q ≤ 200 000), the number of elements in the array and the number of queries for which it is needed to find the answer.

Next q lines contain integers x_{i} (1 ≤ x_{i} ≤ n), the indices of cells for which it is necessary to output their content after Dima's algorithm finishes.


-----Output-----

For each of q queries output one integer number, the value that will appear in the corresponding array cell after Dima's algorithm finishes.


-----Examples-----
Input
4 3
2
3
4

Output
3
2
4

Input
13 4
10
5
4
8

Output
13
3
8
9



-----Note-----

The first example is shown in the picture.

In the second example the final array is [1, 12, 2, 8, 3, 11, 4, 9, 5, 13, 6, 10, 7].

Difficulty: MEDIUM_HARD

Solutions:
import sys
[n, q] = map(int, sys.stdin.readline().strip().split())
qis = [int(sys.stdin.readline().strip()) for _ in range(q)]

def query(n, q):
	d = 2 * n - q
	while d % 2 == 0:
		d //= 2
	return n - d // 2
for qi in qis:
	print(query(n, qi))


import math
from decimal import Decimal

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
(n, q) = map(int, input().split())
ans = []
for i in range(q):
	x = int(input())
	ans.append(x)
for i in ans:
	d = 2 * n - i
	while d % 2 == 0:
		d //= 2
	print(n - d // 2)


import sys

def query(n, a):
	while not a & 1:
		a += n - a // 2
	return a + 1 >> 1
(n, q) = map(int, sys.stdin.readline().split())
arr = [int(sys.stdin.readline()) for _ in range(q)]
sys.stdout.write('\n'.join((str(query(n, a)) for a in arr)))


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(n, q) = map(int, input().split())
for _ in range(q):
	x = int(input())
	for r in range(100):
		num = 2 * n - 2 ** r - x
		den = 2 ** (r + 1)
		if num % den == 0 and n - num // den >= 1 and (n - num // den <= n):
			print(n - num // den)
			break


import sys
input = sys.stdin.readline
(n, q) = list(map(int, input().split()))
x = [int(input()) for i in range(q)]
for num in x:
	num = 2 * n - num
	while True:
		if num % 2 == 0:
			num = num // 2
		else:
			break
	print(n - num // 2)


import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
for i in range(k):
	r = int(input())
	if r % 2 == 1:
		print((r + 1) // 2)
	else:
		ind = r
		while ind % 2 == 0:
			ind = ind + (n - ind // 2)
		print((ind + 1) // 2)


import sys
input = sys.stdin.readline
(n, q) = list(map(int, input().split()))
for i in range(q):
	a = int(input())
	if a % 2 != 0:
		print((a + 1) // 2)
	else:
		b = a // 2
		while 1 > 0:
			a = a + (n - b)
			b = a // 2
			if a % 2 != 0:
				print((a + 1) // 2)
				break


def move(x):
	a = x.pop()
	if a != None:
		for i in range(len(x) - 1, -1, -1):
			if x[i] == None:
				x[i] = a
				return x
	return x

def gen(n):
	x = []
	for i in range(1, 2 * n):
		if i % 2 == 1:
			x.append((i + 1) // 2)
		else:
			x.append(None)
	return x

def solve(x, n):
	print(*x)
	while len(x) != n:
		x = move(x)
		print(*x)
	return x
import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(n, q) = map(int, input().split())
for _ in range(q):
	x = int(input())
	for r in range(100):
		num = 2 * n - 2 ** r - x
		den = 2 ** (r + 1)
		if num % den == 0 and num >= 0 and (den > 0) and (n - num // den >= 1) and (n - num // den <= n):
			i = n - num // den
			print(i)
			break


import sys

def query(n, a):
	while a % 2 == 0:
		a += n - a // 2
	return a // 2 + 1
(n, q) = list(map(int, sys.stdin.readline().split()))
sys.stdout.write('\n'.join((str(query(n, int(input()))) for _ in range(q))))


from sys import *
input = stdin.readline
(n, q) = map(int, input().split())
for _ in range(q):
	i = int(input())
	while i % 2 == 0:
		i += n - i // 2
	print((i + 1) // 2)


import sys
import bisect
input = sys.stdin.readline
t = 1
mod = 10 ** 9 + 7
for _ in range(t):
	(n, q) = map(int, input().split())
	for i in range(q):
		x = int(input())
		if x % 2 != 0:
			print((x + 1) // 2)
		else:
			loop = n - x // 2
			while 1:
				x += loop
				if x % 2 != 0:
					print((x - 1) // 2 + 1)
					break
				loop //= 2


from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)
fac_warm_up = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7

class MergeFind:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n
		self.lista = [[_] for _ in range(n)]

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		if self.size[a] < self.size[b]:
			(a, b) = (b, a)
		self.num_sets -= 1
		self.parent[b] = a
		self.size[a] += self.size[b]
		self.lista[a] += self.lista[b]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def prime_factors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def all_factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def fibonacci_modP(n, MOD):
	if n < 2:
		return 1
	return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD

def factorial_modP_Wilson(n, p):
	if p <= n:
		return 0
	res = p - 1
	for i in range(n + 1, p):
		res = res * cached_fn(InverseEuler, i, p) % p
	return res

def binary(n, digits=20):
	b = bin(n)[2:]
	b = '0' * (digits - len(b)) + b
	return b

def is_prime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True

def generate_primes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	return prime
factorial_modP = []

def warm_up_fac(MOD):
	nonlocal factorial_modP, fac_warm_up
	if fac_warm_up:
		return
	factorial_modP = [1 for _ in range(fac_warm_up_size + 1)]
	for i in range(2, fac_warm_up_size):
		factorial_modP[i] = factorial_modP[i - 1] * i % MOD
	fac_warm_up = True

def InverseEuler(n, MOD):
	return pow(n, MOD - 2, MOD)

def nCr(n, r, MOD):
	nonlocal fac_warm_up, factorial_modP
	if not fac_warm_up:
		warm_up_fac(MOD)
		fac_warm_up = True
	return factorial_modP[n] * (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD) % MOD) % MOD

def test_print(*args):
	if testingMode:
		print(args)

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def display_2D_list(li):
	for i in li:
		print(i)

def prefix_sum(li):
	sm = 0
	res = []
	for i in li:
		sm += i
		res.append(sm)
	return res

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return list(map(int, stdin.readline().split()))

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	nonlocal memory
	memory = dict()

def cached_fn(fn, *args):
	nonlocal memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result

def ncr(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def binary_search(i, li):
	fn = lambda x: li[x] - x // i
	x = -1
	b = len(li)
	while b >= 1:
		while b + x < len(li) and fn(b + x) > 0:
			x += b
		b = b // 2
	return x
TestCases = False
fac_warm_up_size = 10 ** 5 + 100
optimise_for_recursion = True

def main():
	(n, q) = get_tuple()
	diff = (n - 1) * 2 - 1
	for _ in range(q):
		num = get_int()
		if num % 2 != 0:
			print((num + 1) // 2)
			continue
		numerator = diff - num + 3
		n1 = list(bin(numerator))
		k = 0
		for i in n1:
			if i == '1':
				k = 0
			else:
				k += 1
		numerator = diff - num + 3
		x = (numerator // 2 ** k - 1) // 2
		print(n - x)
if TestCases:
	for i in range(get_int()):
		main()
else:
	main() if not optimise_for_recursion else threading.Thread(target=main).start()


import sys
input = sys.stdin.buffer.readline
from math import ceil
(n, q) = map(int, input().split())
for i in range(q):
	indx = int(input())
	count = indx
	if indx % 2 == 0:
		count = 0
		pro = n - indx // 2
		while pro % 2 == 0:
			count += pro
			pro //= 2
		count += pro
		count += indx
	print((count + 1) // 2)