// Arup Guha
// 12/23/2020
// Solution to 2020 NAC Problem K: Rooted Subtrees

import java.util.*;
import java.io.*;

public class rooted {

	public static int n;
	public static ArrayList<Integer>[] g;
	public static ArrayList<Integer>[] anc;
	public static int[] depth;

	public static void main(String[] args) throws Exception {
	
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		
		// Get size & number of queries.
		n = Integer.parseInt(tok.nextToken());
		int numQ = Integer.parseInt(tok.nextToken());
		
		// Allocate space for everything.
		g = new ArrayList[n];
		for (int i=0; i<n; i++) g[i] = new ArrayList<Integer>();
		depth = new int[n];
		anc = new ArrayList[n];
		
		// Add edges.
		for (int i=0; i<n-1; i++) {
			tok = new StringTokenizer(stdin.readLine());
			int u = Integer.parseInt(tok.nextToken())-1;
			int v = Integer.parseInt(tok.nextToken())-1;
			g[u].add(v);
			g[v].add(u);
		}
		
		// Fill up info for LCA
		fillInfo(0,-1, 0);
		
		StringBuffer sb = new StringBuffer();
		
		// Process queries.
		for (int i=0; i<numQ; i++) {
			tok = new StringTokenizer(stdin.readLine());
			int u = Integer.parseInt(tok.nextToken())-1;
			int v = Integer.parseInt(tok.nextToken())-1;
			int top = getLCA(u, v);
			
			// Number of vertices on path between u and v.
			long pathLen = depth[v] + depth[u] - 2*depth[top] + 1;
			
			// Here is our formula, and choice of vertices on path creates new subset, as do all vertices not on path.
			long res = n - pathLen + pathLen*(pathLen+1)/2;
			sb.append(res+"\n");
		}
		
		// Ta da!
		System.out.print(sb);
	}
	
	public static void fillInfo(int v, int par, int d) {
	
		// Update the depth here.
		depth[v] = d;
		anc[v] = new ArrayList<Integer>();
		
		// Build LCA chart.
		int i = 0;
		int prev = par;
		while (prev != -1) {
			anc[v].add(prev);
			prev = i < anc[prev].size() ? anc[prev].get(i): -1;
			i++;
		}
		
		// Recursively call on children.
		for (Integer x: g[v]) {
			if (x.equals(par)) continue;
			fillInfo(x, v, d+1);
		}
	}
	
	public static int getLCA(int u, int v) {
		
		// Made it!
		if (u == v) return u;
		
		// I assume u is deeper than v.
		if (depth[u] < depth[v]) return getLCA(v, u);
		
		// How much I have to climb...
		int diff = depth[u] - depth[v];
		
		// Climb up by powers of 2.
		int i = 20;
		while (diff > 0) {
			if ((diff & (1<<i)) != 0) {
				u = anc[u].get(i);
				diff -= (1<<i);
			}
			i--;
		}
		
		// Now, climb together.
		i = 20;
		while (u != v) {
			
			// We don't want to jump this high.
			if  (i>0 && ((depth[u] < (1<<i)) || anc[u].get(i).equals(anc[v].get(i)))) {
				i--;
				continue;
			}
			
			// Climb up.
			u = anc[u].get(i);
			v = anc[v].get(i);
			if (i>0) i--;
		}
		
		// Here we are.
		return u;
	}
}
