title: First Element Occurring K Times Array
signature: firstElementOccurringKTimesArray(arr, n, k) {
source_py: def first_element_occurring_k_times_array(arr, n, k):
      count_map = {
          
      }
      for i in range(0, n):
          if (arr[i] in count_map.keys()):
              count_map[arr[i]] += 1
          else:
              count_map[arr[i]] = 1
          i += 1
      for i in range(0, n):
          if (count_map[arr[i]] == k):
              return arr[i]
          i += 1
      return (- 1)
source_cpp: int first_element_occurring_k_times_array(vector<int> arr, int n, int k) {
    unordered_map < int, int > count_map;
    for ( int i = 0;
    i < n;
    i ++ ) count_map [ arr [ i ] ] ++;
    for ( int i = 0;
    i < n;
    i ++ ) if ( count_map [ arr [ i ] ] == k ) return arr [ i ];
    return - 1;
  }