#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int n, m;
  cin >> n >> m;
  queue<pair<int, pair<int, int> > > q;
  for (int i = 1; i <= n; ++i) {
    int d;
    cin >> d;
    q.push(make_pair(i, make_pair(0, d)));
  }
  int lastLeft = -1;
  while (!q.empty()) {
    pair<int, pair<int, int> > p = q.front();
    q.pop();
    p.second.first += m;
    if (p.second.first < p.second.second) {
      q.push(p);
    } else {
      lastLeft = p.first;
    }
  }
  cout << lastLeft << endl;
  return 0;
}
