#define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
	do {\
		std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
		debug_impl(__VA_ARGS__);\
		std::cerr << std::noboolalpha;\
	} while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
	{ for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
	for (auto it = v.begin(); it != v.end(); it++)
		{os << (it != v.begin() ? "," : "") << *it;}
	return os << "}";
}

template < template < typename ... > class Tuple,  typename... Args, std::size_t ... Inds, std::size_t = std::tuple_size< Tuple < Args ... > >::value >
std::istream& tuple_input_impl(std::istream& os, Tuple<Args...>& tuple, std::integer_sequence<std::size_t, Inds...>)
	{ (void)std::initializer_list<int>{((void)(os >> std::get< Inds >(tuple)), 0)...}; return os; }
template < template < typename ... > class Tuple,  typename... Args, std::size_t = std::tuple_size< Tuple < Args ... > >::value >
std::istream& operator>> (std::istream& os, Tuple<Args...>& tuple)
	{ return tuple_input_impl(os, tuple, std::index_sequence_for<Args...>()); }

template < template < typename ... > class Tuple,  typename... Args, std::size_t ... Inds, std::size_t = std::tuple_size< Tuple < Args ... > >::value >
std::ostream& tuple_output_impl(std::ostream& os, const Tuple<Args...>& tuple, std::integer_sequence<std::size_t, Inds...>)
	{ os << "("; (void)std::initializer_list<int>{((void)(os << (Inds > 0 ? "," : "") << std::get< Inds >(tuple)), 0)...}; return os << ")"; }
template < template < typename ... > class Tuple,  typename... Args, std::size_t = std::tuple_size< Tuple < Args ... > >::value >
std::ostream& operator<< (std::ostream& os, const Tuple<Args...>& tuple)
 { return tuple_output_impl(os, tuple, std::index_sequence_for<Args...>()); }

int main() {
	std::cin.tie(0); std::cin.sync_with_stdio(false);
	lint X; std::cin >> X;
	int n; std::cin >> n;
	std::vector<lint> a(n); std::cin>>a;
	std::vector<lint> d(n);
	std::adjacent_difference(all(a), d.begin());
	debug(d);

	// t,l,r,L,R
	std::vector<std::tuple<lint,lint,lint,lint,lint>> data;
	data.emplace_back(0,0,X,0,X);
	rep(i,0,n) {
		lint x = d.at(i);
		lint t,l,r,L,R; std::tie(t,l,r,L,R) = data.back();
		t += x;
		if (i % 2 == 0) { // decrease
			L -= x;
			R -= x;
			if (R < 0) {
				L = R = 0;
				l = r = -1;
			} else if (L < 0) {
				l += -L;
				L = 0;
			}
		} else { // increase
			L += x;
			R += x;
			if (X < L) {
				L = R = X;
				l = r = -1;
			} else if (X < R) {
				r -= R - X;
				R = X;
			}
		}
		data.emplace_back(t,l,r,L,R);
	}
	debug(data);

	auto solve = [&] (lint u, lint a)	{
		if (u == 0) return a;
		// debug(u,a);
		auto it = std::prev(std::upper_bound(all(data), std::make_tuple(u,0,0,0,0)));
		auto prev = *it;
		int i = it - data.begin();
		// debug(i, prev);

		lint t,l,r,L,R; std::tie(t,l,r,L,R) = prev;
		lint y = L + std::max(0ll, std::min(r - l, a - l));
		lint ans = y;
		if (i % 2 == 0) { // decrease
			ans -= u - t;
		} else { // increase
			ans += u - t;
		}
		cmx(ans, 0ll);
		cmn(ans, X);
		// debug(y);
		return ans;
	};

	// rep(t,0,18) {
	// 	std::cout << "t:" << t;
	// 	rep(a,0,6) {
	// 		std::cout << " " << solve(t,a);
	// 	}
	// 	std::cout << std::endl;
	// }

	int q; std::cin >> q;
	loop(q) {
		lint u, a; std::cin >> u >> a;
		lint ans = solve(u,a);
		std::cout << ans << std::endl;
	}
	return 0;
}

Measured memory_bytes: 8816