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