#include <bits/stdc++.h>
using namespace std;
int main() {
  queue<int> child;
  queue<int> cand;
  int n, m, num;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    child.push(i);
    cin >> num;
    cand.push(num);
  }
  while (!child.empty()) {
    if (cand.front() <= m) {
      if (child.size() == 1) {
        cout << child.front();
        break;
      }
      child.pop();
      cand.pop();
    } else {
      if (cand.front() - m > 0) {
        child.push(child.front());
        cand.push(cand.front() - m);
        cand.pop();
        child.pop();
      } else if (cand.front() - m <= 0) {
        cand.pop();
        child.pop();
      }
    }
  }
  return 0;
}
