You may achieve this with the help of jQuery as follows,
$(function () {
var wrapperWidth = $('.wrapper').width();
$('.wrapper').children('.outer').each(function () {
var mainWidth = $(this).children('.main').width();
var sutraction = wrapperWidth - mainWidth - 4;
// 4 is value of total border width i.e. blue and green border can be adjusted as per ur need
$(this).children('.sub').css('width', sutraction);
});
});
Hope it helps!