83152024-01-14 17:47:05qertendVirágos rét (50 pont)javaCompilation error
import java.io.IOException;
import mester.IO;

/**
 * feladat 1
 */
public class feladat {

    public static void main(String[] args) throws IOException {
        IO io = new IO();
        int retekSzama = io.nextInt();
        int K = io.nextInt();
        int szabadRetek = 0;

        for (int i = 0; i < retekSzama; i++) {
            if (io.nextInt() == 1) szabadRetek++;
        }
        int N = szabadRetek-K+1;
        if (szabadRetek >= K) io.write((N)*(N+1)/2); //write the sum of all positive integers up to N (inclusive)
        else io.write(0);

        io.close();
    }
}
Compilation error
exit status 1