I think, my code below is correct. I want to access 5, then 9, 10, 13, 14 and 15, but I really do not know why it is missing the 5 completely and index of M is starting from 2.
#include <iostream>
#include <vector>
    
int main() {
  std::vector<std::vector<int>> matrix_val = {
    {1,2,3,4,50},
    {5,6,7,8,90},
    {9,10,11,12,130},
    {13,14,15,16,300}
  };
    
  for (int M = 1; M < 4; M++) {  
    for (int k = 0; k < M - 1; k++) {  
      std::cout << " Matix_val is " << matrix_val[M][k] 
                << " Value of M " << M 
                << " Value of k " << k 
                << std::endl;
    }    
  }
 
     
     
     
     
    