LEAFEAT Runtime Error?

Does anybody know how the code below could throw a runtime error for this problem?

import java.util.ArrayList;
import java.util.Scanner;

class Main {
/*LEAFEAT*/

public static void main(String[] args) {
	Scanner reader = new Scanner(System.in);
	String firstLine = reader.nextLine();
	//N is the number of leaves
	int N = Integer.parseInt(firstLine.split(" ")[0]);
	ArrayList<Integer> leafNumbers = new ArrayList<Integer>();
	for(int i=1;i<=N;i++) {
		leafNumbers.add(i);
	}
	//K is the number of caterpillars
	byte K = Byte.parseByte(firstLine.split(" ")[1]);
			
	for (byte i=1;i<=K;i++) {
		int caterpillarLength = Integer.parseInt(reader.nextLine());
		for (int j=1;i<=N;j=j+caterpillarLength) {
			if(j <= N) {
				leafNumbers.remove((Integer) j);
			} else {
				break;
			}
		}
	}
	reader.close();
	//System.out.println(leafNumbers.toString());

	System.out.println(leafNumbers.size());
}
}

I think, that RE is our first problem, TLE will be next…

On ideone it ends with RE for N = 10^9 - http://ideone.com/FKWK4K