#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
int main() {
  queue<ii> q;
  int n, m;
  cin >> n >> m;
  int a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    q.emplace(a, i + 1);
  }
  while (q.size() > 1) {
    if (q.front().first <= m) {
      q.pop();
    } else {
      q.emplace(q.front().first - m, q.front().second);
      q.pop();
    }
  }
  cout << q.front().second;
  return 0;
}
