#include <bits/stdc++.h>
using namespace std;
queue<pair<int, int>> Q;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int u;
    cin >> u;
    Q.push(pair<int, int>(u, i + 1));
  }
  while (Q.size() > 1) {
    pair<int, int> u = Q.front();
    Q.pop();
    if (u.first <= m) continue;
    u.first = u.first - m;
    Q.push(u);
  }
  int ans = Q.front().second;
  cout << ans << endl;
  return 0;
}
