#include <bits/stdc++.h>
using namespace std;
signed main() {
  queue<pair<long long, long long>> q;
  long long n, m, in;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> in;
    q.push({in, i});
  }
  pair<long long, long long> front;
  while (!q.empty()) {
    front = q.front();
    q.pop();
    front.first -= m;
    if (front.first > 0) {
      q.push(front);
    }
  }
  cout << front.second + 1;
}
