Basically, this solution combines both your solutions, it iterates over segments of size 1000 and uses your cumsum solution to process 1000 elements at once.
threshold=100;
a=0; MAX=9999999;
%segment size
S=1000;
for segment_start=1:S:MAX
%process segment from _start to _end
segment_end=min(segment_start+S-1,MAX);
%which contains _count elements
segment_count=segment_end-segment_start+1;
%now use the cumsum solution to process the segment
c=normrnd(2,1,segment_count,1);
c=cumsum(c);
index=find(c>threshold-a,1,'first');
if isempty(index)
%need to continue
a=a+c(end);
else
%threshhold reached, found solution
a=a+c(index);
break;
end
end