import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 class segtree(): def __init__(self,V,OP,E): self.n=len(V) self.op=OP self.e=E self.log=(self.n-1).bit_length() self.size=1<>=1 r>>=1 return self.op(sml,smr) def update(self,k): self.d[k]=self.op(self.d[2*k],self.d[2*k+1]) def EulerTour(s, graph): n = len(graph) visit = [False] * n visit[s] = True q = [s] ret = [] while q: now = q.pop() if now >= 0: ret.append(now) for to in graph[now][::-1]: if not visit[to]: visit[to] = True q.append(~now) q.append(to) else: ret.append(~now) return ret def CalcDepth(s, graph): INF = 2 ** 63 - 1 from collections import deque n = len(graph) depth = [INF] * n depth[s] = 0 q = deque() q.append(s) while q: now = q.popleft() for to in graph[now]: if depth[to] == INF: depth[to] = depth[now] + 1 q.append(to) return depth class LCA(): def __init__(self, graph): self.INF = 2 ** 63 - 1 self.graph = graph self.N = len(self.graph) self.ET = EulerTour(0, self.graph) self.depth = CalcDepth(0, graph) self.disc = [-1] * (self.N) self.fin = [-1] * (self.N) for i, v in enumerate(self.ET): if self.disc[v] == -1: self.disc[v] = i self.fin[v] = i self.S = segtree([(self.ET[i], self.depth[self.ET[i]]) for i in range(len(self.ET))], lambda x, y: x if x[1] <= y[1] else y, (-1, self.INF)) def lca(self, u, v): st = min(self.disc[u], self.disc[v]) en = max(self.fin[u], self.fin[v]) + 1 ver, _ = self.S.prod(st, en) return ver def dist(self, u, v): a = self.lca(u, v) return self.depth[u] + self.depth[v] - 2 * self.depth[a] n, q = mi() graph = [[] for _ in range(n)] for _ in range(n - 1): u, v = mi() u -= 1; v -= 1 graph[u].append(v) graph[v].append(u) d = CalcDepth(0, graph) p = list(range(n)) p.sort(key = lambda x: d[x], reverse=True) subt = [0] * n for v in p: for to in graph[v]: if d[to] > d[v]: subt[v] += subt[to] subt[v] += 1 L = LCA(graph) for _ in range(q): s, t = mi() s -= 1; t -= 1 if L.dist(s, t) % 2 == 1: print(0) else: l = L.lca(s, t) print(n - subt[l] + 1)