#include <bits/stdc++.h>
using namespace std;
int n, m, a[1001];
queue<int> q;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    q.push(i);
  }
  while (q.size() > 1) {
    int v = q.front();
    q.pop();
    if (a[v] - m > 0) q.push(v);
    a[v] -= m;
  }
  cout << q.front();
  return 0;
}
