package ru.redguy.tasks;

import com.google.common.collect.Lists;
import ru.redguy.ATask;
import ru.redguy.Task;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

@ATask("5028")
public class Task5028 extends Task {

    @Override
    public void run() throws IOException {
        HashMap<Integer,Boolean> map = new HashMap<>();
        String s = getFile("27-98b.txt");
        ArrayList<String> arr = Lists.newArrayList(s.split("\r\n"));
        String header = arr.get(0);
        arr.remove(0);
        int max = Integer.parseInt(header.split(" ")[1]);
        var ref = new Object() {
            int lineMax = 0;
            int line = 0;
        };
        arr.stream()
                .map(Integer::parseInt)
                .forEach(k -> {
                    if(k<max) {
                        ref.line++;
                    } else {
                        if(ref.lineMax <ref.line) {
                            ref.lineMax = ref.line;
                        }
                        ref.line = 0;
                    }
                });
        if(ref.lineMax <ref.line) {
            ref.lineMax = ref.line;
        }
        System.out.println(ref.lineMax);
    }
}