submission beat 100% of other submissions' runtime|| c++||  using prefix sum || optimal solution ||
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    vector<int> answerQueries(vector<int>& nums, vector<int>& queries) {
        int  n = nums.size();
        int m = queries.size();
       sort(nums.begin(), nums.end()); //sort the nums array  

       //find the prefix sum 
        
       vector<int>prefix(n ,0); //size of the vector is same as the nums  

   prefix[0] = nums[0]; //first  ele is same  

   for(int  i=1 ;i<n ;i++){
       prefix[i] = prefix[i-1] + nums[i]; //just add the prefix[0] and the curent for prefix sum      
   } 

   vector<int>ans; //for storing the ans 

   for(int i =0 ;i<m ;i++){
  int  first_val = queries[i];
    ans.push_back(upper_bound(prefix.begin() , prefix.end() , first_val) - prefix.begin()); //find out the position of the firstval 
   }


   return ans ; // return the ans vector 

    }
};
```
['C++']