func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int m;     cin >> m;     int i;     map<int, int> ipattern;     for (i = 1; i <= n; i++) {       int x;       cin >> x;       ipattern[i] = x;     }     int max = 0;     for (i = 1; i <= n; i++) {       if (ipattern[i] > max) {         max = ipattern[i];       }     }     int r = max % m;     int an = max / m;     if (r == 0)       an = an - 1;     else {       an = an;     }     int j;     if (an == 0) {       cout << n;     } else {       for (j = 1; j <= an; j++) {         for (i = 1; i <= n; i++) {           if ((ipattern[i] - m) <= 0) {             ipattern.erase(i);           } else {             ipattern[i] = ipattern[i] - m;           }         }       }       int y;       for (auto itr = ipattern.begin(); itr != ipattern.end(); ++itr) {         y = itr->first;       }       cout << y << endl;     }   }   