#include<stdio.h>
#include<math.h>
int main(){
	int n, q;
	scanf("%d%d", &n, &q);
	int niz[n];
	int slucajevi[q];
	
	for (int i = 0; i < n; i++) 
		scanf("%d", &niz[i]);
	
	for (int i = 0; i < q; i++)
		scanf("%d", &slucajevi[i]);

	for (int i = 1; i < n; i++)
		for (int j = 0; j < n - i; j++)
			if (niz[j] > niz[j + 1]) {
				int pom = niz[j];
				niz[j] = niz[j + 1];
				niz[j + 1] = pom; 
			}
	
	for (int i = 0; i < q; i++){
		int pre = 0;
		for (int j = 0; j < n; j++){
			if (niz[j] >= slucajevi[i])
				break;
			pre++;
		}	 
		int posle = n - pre ;
		if (slucajevi[i] > niz[n / 2] && slucajevi[i] != niz[pre] ) posle++;
		printf("%d %d %d\n", pre, posle, abs(posle - pre));
	}
}