Problem:
Score : 200 points

Problem Statement

N friends of Takahashi has come to a theme park.

To ride the most popular roller coaster in the park, you must be at least K centimeters tall.

The i-th friend is h_i centimeters tall.

How many of the Takahashi's friends can ride the roller coaster?

Constraints

1 \le N \le 10^5

1 \le K \le 500

1 \le h_i \le 500

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
h_1 h_2 \ldots h_N

Output

Print the number of people among the Takahashi's friends who can ride the roller coaster.

Sample Input 1

4 150
150 140 100 200

Sample Output 1

2

Two of them can ride the roller coaster: the first and fourth friends.

Sample Input 2

1 500
499

Sample Output 2

0

Sample Input 3

5 1
100 200 300 400 500

Sample Output 3

5

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Runtime Error)

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] h = new int[n];
		for (int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		Arrays.sort(h);
		System.out.println(calc(h, k));	
	}

	private static int calc(int[] h, int k) {
		int n = h.length;
		if (h[0] >= k) {
			return n;
		}
		int middleIndex = (n / 2) - 1;
		if (middleIndex < 0) {
			return 0;
		}
		int middle = h[middleIndex];
		if (middle == k) {
			return n - middleIndex;
		}
		if (middle < k) {
			h = Arrays.copyOfRange(h, middleIndex + 1, n);
		} else {
			h = Arrays.copyOfRange(h, 0, middleIndex - 1);
		}
		return calc(h, k);
	}
}